@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo.woff2') format('woff2-variations'), url('/fonts/archivo.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --bg: #141518;
  --surface: #1c1e22;
  --surface-2: #24272c;
  --line: #2c2f35;
  --chalk: #eceae4;
  --muted: #9a9da5;
  --faint: #6b6f78;
  --red: #d93a3a;
  --blue: #3b78e0;
  --yellow: #e8b931;
  --green: #2e9e5b;
  --iron: #6b6f78;
  --danger: #ff6b5e;
  --radius: 18px;
  --gutter: 20px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--chalk);
  font: 400 16px/1.5 'Archivo', system-ui, sans-serif;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--chalk); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }

main { max-width: 560px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) var(--gutter) 24px; }

/* Type scale */
.date { color: var(--muted); font-size: 15px; margin: 8px 0 0; }
h1 {
  font-size: 64px; line-height: .95; font-weight: 800; font-stretch: 72%;
  letter-spacing: -.01em; margin: 4px 0 0;
}
h1 small { font-size: 22px; font-weight: 500; color: var(--muted); font-stretch: 100%; letter-spacing: 0; margin-left: 6px; }
h2 { font-size: 26px; line-height: 1.1; font-weight: 750; font-stretch: 80%; margin: 40px 0 12px; }
h3 { font-size: 17px; line-height: 1.3; font-weight: 600; margin: 0; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag { font-size: 13px; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); color: var(--chalk); }
.tag.jjb { background: rgba(217, 58, 58, .18); color: #ff9a8f; }

.stats { display: flex; gap: 22px; margin-top: 16px; color: var(--muted); font-size: 14px; }
.stats b { display: block; color: var(--chalk); font-size: 20px; font-weight: 700; font-stretch: 80%; }

/* Barbell hero */
.bar-hero { margin: 26px -8px 0; }
.bar-hero svg { width: 100%; height: auto; display: block; }
.kcal-big { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.kcal-big .now { font-size: 44px; font-weight: 800; font-stretch: 75%; line-height: 1; }
.kcal-big .of { color: var(--muted); font-size: 17px; }

.meter { margin-top: 14px; }
.meter-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.meter-row b { color: var(--chalk); font-weight: 600; }
.track { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--chalk); border-radius: 99px; transition: width .5s ease; }
.fill.prot { background: var(--blue); }

.plan-sum { margin-top: 14px; font-size: 14px; color: var(--muted); }

/* Day nav */
.daynav { display: flex; justify-content: space-between; align-items: center; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 99px; border: 1px solid var(--line); background: transparent;
  display: inline-grid; place-items: center; color: var(--chalk);
}
.icon-btn svg { width: 18px; height: 18px; }
.link { background: none; border: 0; padding: 0; color: var(--chalk); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }

/* Meal timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.slot { position: relative; padding: 18px 0 18px 30px; border-top: 1px solid var(--line); }
.slot:last-child { border-bottom: 1px solid var(--line); }
.plate {
  position: absolute; left: 0; top: 22px; width: 16px; height: 16px; border-radius: 99px;
  border: 3px solid var(--c, var(--iron));
}
.plate.done { background: var(--c, var(--iron)); }
.slot-label { font-size: 13px; color: var(--muted); margin-bottom: 2px; display: flex; justify-content: space-between; gap: 8px; }
.facts { font-size: 14px; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.facts b { color: var(--chalk); font-weight: 600; }

details { margin-top: 10px; }
summary { list-style: none; cursor: pointer; font-size: 14px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ''; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .2s; }
details[open] summary::after { transform: rotate(225deg) translateY(-2px); }
.ingr { list-style: none; padding: 0; margin: 10px 0 0; font-size: 15px; }
.ingr li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.ingr li span:last-child { color: var(--muted); text-align: right; white-space: nowrap; }
.steps { margin: 12px 0 0; padding-left: 20px; font-size: 15px; color: #cfcdc7; }
.steps li { margin-bottom: 6px; }
.note { font-size: 14px; color: var(--muted); margin-top: 8px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  border: 0; border-radius: 99px; padding: 10px 16px; font-size: 15px; font-weight: 600;
  background: var(--chalk); color: #141518; min-height: 44px;
}
.btn.ghost { background: transparent; color: var(--chalk); border: 1px solid var(--line); }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.eaten { font-size: 14px; color: var(--green); display: inline-flex; align-items: center; gap: 8px; min-height: 36px; }

/* Lunch options side by side */
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.option {
  text-align: left; border: 1px solid var(--line); background: transparent; border-radius: 14px; padding: 12px;
  min-height: 92px;
}
.option[aria-pressed='true'] { border-color: var(--chalk); background: var(--surface); }
.option .o-title { font-size: 13px; color: var(--muted); }
.option .o-name { font-size: 15px; font-weight: 600; margin: 2px 0 4px; line-height: 1.25; }
.option .o-kcal { font-size: 14px; color: var(--muted); }

.toggle { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; margin-top: 10px; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--chalk); }

/* Tips */
.tip { padding: 16px 0; border-top: 1px solid var(--line); }
.tip:last-of-type { border-bottom: 1px solid var(--line); }
.tip .theme { font-size: 13px; color: var(--muted); }
.tip p { margin: 6px 0 0; color: #d7d5cf; }
.tip .cost { font-size: 13px; color: var(--muted); margin-top: 6px; }
.tip-actions { display: flex; gap: 8px; margin-top: 10px; }
.chip-btn {
  border: 1px solid var(--line); background: transparent; border-radius: 99px; padding: 6px 12px;
  font-size: 14px; min-height: 36px; color: var(--muted);
}
.chip-btn[aria-pressed='true'] { color: var(--chalk); border-color: var(--chalk); background: var(--surface); }

.defi { margin-top: 20px; padding: 18px; border-radius: var(--radius); background: var(--surface); }
.defi h3 { font-size: 20px; font-stretch: 85%; font-weight: 700; margin: 4px 0 6px; }
.streak { font-size: 14px; color: var(--muted); margin-top: 10px; }

/* Panels / forms */
.panel { background: var(--surface); border-radius: var(--radius); padding: 18px; margin-top: 12px; }
.field { display: block; margin-top: 10px; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  padding: 10px 14px; font-size: 16px;
}
.input:focus { border-color: var(--chalk); outline: none; }
.input.sm { min-height: 40px; width: 92px; padding: 6px 10px; text-align: right; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }

.photo-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; border-radius: 16px;
  background: var(--chalk); color: #141518; font-weight: 700; font-size: 17px; cursor: pointer;
}
.photo-btn svg { width: 22px; height: 22px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.preview { width: 100%; max-height: 240px; object-fit: cover; border-radius: 14px; margin-top: 12px; display: block; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .meta { font-size: 13px; color: var(--muted); }
.x-btn { width: 36px; height: 36px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--muted); flex: none; }

.item-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.item-row .meta { font-size: 13px; color: var(--muted); }
.estimate { font-size: 13px; color: var(--yellow); }
.question { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(232, 185, 49, .12); font-size: 14px; }

.stepper { display: flex; align-items: center; gap: 12px; }
.stepper .val { font-size: 28px; font-weight: 800; font-stretch: 75%; min-width: 110px; text-align: center; }

.empty { color: var(--muted); font-size: 15px; padding: 14px 0; }
.error { color: var(--danger); font-size: 14px; margin-top: 8px; }

/* Chips filter */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips .chip-btn { white-space: nowrap; }

/* Shopping */
.rayon { margin-top: 26px; }
.rayon h3 { font-size: 14px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.shop { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.shop input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--chalk); }
.shop.owned .name { text-decoration: line-through; color: var(--faint); }
.shop .meta { font-size: 13px; color: var(--muted); }
.shop .price { display: flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.totals div { background: var(--surface); border-radius: 14px; padding: 14px; font-size: 13px; color: var(--muted); }
.totals b { display: block; font-size: 26px; color: var(--chalk); font-weight: 800; font-stretch: 75%; }

/* Chart */
.chart svg { width: 100%; height: auto; display: block; margin-top: 8px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; background: var(--chalk); }
.legend i.t { background: var(--yellow); }
.legend i.d { width: 6px; height: 6px; border-radius: 99px; background: var(--faint); }

.recipe { padding: 16px 0; border-bottom: 1px solid var(--line); }
.recipe.disliked h3 { color: var(--faint); text-decoration: line-through; }

/* Login */
.login { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; }
.login h1 { font-size: 96px; }

/* Tab bar */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: rgba(20, 21, 24, .82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
nav.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; min-height: 52px;
  color: var(--faint); text-decoration: none; font-size: 11px; border-radius: 12px;
}
nav.tabs a svg { width: 24px; height: 24px; }
nav.tabs a[aria-current='page'] { color: var(--chalk); }
nav.tabs[hidden] { display: none; }

/* Skeletons */
.sk { background: var(--surface); border-radius: 10px; position: relative; overflow: hidden; }
.sk::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .05), transparent);
  transform: translateX(-100%); animation: sk 1.3s infinite;
}
@keyframes sk { to { transform: translateX(100%); } }
.sk-line { height: 14px; margin: 10px 0; }
.sk-title { height: 58px; width: 55%; margin-top: 8px; }
.sk-bar { height: 120px; margin-top: 26px; border-radius: 14px; }
.sk-row { height: 74px; margin-top: 10px; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--chalk); color: #141518; padding: 10px 16px; border-radius: 99px; font-size: 14px; font-weight: 600;
  z-index: 20; max-width: calc(100% - 40px); text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .sk::after { animation: none; }
  .fill { transition: none; }
  .bar-hero .plate-new { animation: none !important; }
}
@keyframes load-plate { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
.bar-hero .plate-new { animation: load-plate .45s cubic-bezier(.2, .8, .2, 1.2) both; transform-box: fill-box; }

.list .plate { position: static; flex: none; }
hr.sep { border: 0; border-top: 1px dashed var(--line); margin: 16px 0; }

/* Photos */
.meal-head { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; }
.thumb { width: 84px; height: 84px; border-radius: 14px; object-fit: cover; background: var(--surface); cursor: zoom-in; }
.thumb-sm { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface); cursor: zoom-in; }
.thumb-xs { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface); cursor: zoom-in; }
.thumb-opt { width: 100%; aspect-ratio: 16 / 10; height: auto; border-radius: 8px; object-fit: cover; display: block; margin-bottom: 8px; }
.ingr li { align-items: center; }
.ingr-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.shop-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.food-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; margin-top: 12px; }
.food h3 { font-size: 15px; margin-top: 8px; }
.food .meta { font-size: 13px; color: var(--muted); }
.food-img { width: 100%; aspect-ratio: 1; height: auto; border-radius: 14px; object-fit: cover; display: block; background: var(--surface); cursor: zoom-in; }
.credits-link { margin-top: 28px; }
.zoom {
  position: fixed; inset: 0; z-index: 30; background: rgba(10, 11, 13, .92);
  display: grid; place-items: center; padding: 20px; cursor: zoom-out;
}
.zoom img { width: min(100%, 480px); height: auto; border-radius: 18px; }
@media (max-width: 360px) { .thumb { width: 68px; height: 68px; } }

/* Profile form */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 8px; }
.grid3 .field span { font-size: 13px; }
.lbl { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg label, .daychips label, .foodchips label { position: relative; cursor: pointer; }
.seg input, .daychips input, .foodchips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: block; text-align: center; padding: 11px; border-radius: 12px; border: 1px solid var(--line); color: var(--muted); }
.daychips { display: flex; gap: 6px; }
.daychips span[aria-hidden] { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.foodchips { display: flex; flex-wrap: wrap; gap: 6px; }
.foodchips span { display: inline-block; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.seg input:checked + span, .daychips input:checked + span, .foodchips input:checked + span { background: var(--chalk); color: #141518; border-color: var(--chalk); }
.foodchips input:checked + span { background: rgba(255, 107, 94, .16); color: #ffb3aa; border-color: rgba(255, 107, 94, .5); text-decoration: line-through; }
.seg input:focus-visible + span, .daychips input:focus-visible + span, .foodchips input:focus-visible + span { outline: 2px solid var(--chalk); outline-offset: 2px; }
.logout { margin-top: 24px; }
@media (max-width: 360px) { .daychips span[aria-hidden] { width: 34px; height: 34px; } }
.grid2 > *, .grid3 > * { min-width: 0; }
input[type=date].input { min-width: 0; max-width: 100%; display: block; -webkit-appearance: none; }

/* Physique */
.phys-pick { display: block; cursor: pointer; }
.phys-pick img, .phys-ph { width: 100%; aspect-ratio: 3 / 4; border-radius: 14px; object-fit: cover; display: block; }
.phys-ph { display: grid; place-items: center; border: 1.5px dashed var(--line); color: var(--muted); font-size: 14px; text-align: center; padding: 10px; }
.phys-result h3 { margin-top: 16px; font-size: 16px; }
.phys-result p { color: #d7d5cf; }
.bullets { margin: 6px 0 0; padding-left: 18px; color: #d7d5cf; }
.bullets li { margin-bottom: 4px; }
.foodchips.regimes input:checked + span { background: var(--chalk); color: #141518; border-color: var(--chalk); text-decoration: none; }
.guide-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; padding: 18px; border-radius: var(--radius); background: var(--surface); color: var(--chalk); text-decoration: none; }
.guide-card > span:last-child { font-size: 28px; color: var(--muted); }
.guide-item + .guide-item { margin-top: 14px; }
.guide-item h3 { font-size: 16px; }
.guide-item p { margin: 4px 0 0; color: #d7d5cf; }
.phase-tags { margin-top: 6px; display: flex; gap: 6px; }
.ai-wait { margin-top: 26px; }
