/* Minimal DAW "Warm" palette; light and dark follow the device */
:root {
  --bg: #efeee9; --surface: #fbfbf9; --fill: #cdcac2; --fill-soft: #e5e3dd;
  --ink: #2b2b29; --muted: #8a8882; --line: #dcdad3; --pill: #4a4946; --pill-ink: #f6f5f1;
  --red: #c4553f; --amber: #c48a2c; --green: #5e8f62; --blue: #4f77a3;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.06);
  --serif: ui-serif, 'New York', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a19; --surface: #222220; --fill: #3a3935; --fill-soft: #2c2b29;
    --ink: #ecebe6; --muted: #8f8d86; --line: #33322f; --pill: #e4e2db; --pill-ink: #1d1d1c;
    --red: #d9705c; --amber: #d6a24e; --green: #86ae84; --blue: #7d9ec4;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--sans);
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  max-width: 980px; margin-inline: auto;
}
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 28px; line-height: 1.15; }
h3 { font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
button { font: inherit; color: inherit; }

/* Header + tabs: tabs sit at the bottom of the screen on phones */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0 10px; }
.tabs { display: flex; gap: 4px; background: var(--fill-soft); border-radius: 999px; padding: 4px; }
.tabs a {
  text-decoration: none; padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 550; color: var(--muted);
}
.tabs a.on { background: var(--pill); color: var(--pill-ink); }
@media (max-width: 640px) {
  .top { padding-top: 14px; }
  .tabs {
    position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; border-radius: 0; justify-content: space-around;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
  }
  .tabs a { padding: 8px 6px; font-size: 13px; flex: 1; text-align: center; }
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
}

main { display: grid; gap: 14px; padding-bottom: 24px; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 0 28px; font-size: 13px; border-top: 1px solid var(--line); }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card > h3 { margin-bottom: 8px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--pill); border-radius: 999px;
  padding: 6px 14px; background: transparent; font-size: 14px; font-weight: 550; cursor: pointer; text-decoration: none;
}
.pill.solid { background: var(--pill); color: var(--pill-ink); }
.pill:disabled { opacity: 0.4; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; background: var(--fill-soft); color: var(--muted); }
.tag.prep { background: color-mix(in srgb, var(--amber) 20%, transparent); color: var(--amber); }
.tag.shop { background: color-mix(in srgb, var(--blue) 18%, transparent); color: var(--blue); }
.tag.now { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.warn { color: var(--red); font-size: 13px; }

/* Day header with ‹ › */
.daynav { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.daynav .arrows { display: flex; gap: 6px; }
.daynav .arrows .pill { min-width: 36px; height: 36px; justify-content: center; }

/* Meal timeline */
.meals { list-style: none; margin: 0; padding: 0; }
.meals li { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.meals li:first-child { border-top: 0; }
.meals .time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; padding-top: 2px; }
.meals .slot { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.meals .name { font-weight: 600; }
.meals li.past { opacity: 0.45; }
.meals li.next .time { color: var(--red); font-weight: 650; }

.upcoming { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* Week grid */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week .day { display: block; text-decoration: none; color: inherit; background: var(--surface); border-radius: 12px; padding: 10px; box-shadow: var(--shadow); min-width: 0; }
.week .day.today { outline: 2px solid var(--pill); }
.week .day h3 { font-size: 15px; display: flex; justify-content: space-between; }
.week .day .m { font-size: 13px; padding: 5px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.week .day .m:first-of-type { border-top: 0; }
.week .day .m span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.week .marks { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
@media (max-width: 760px) {
  .week { grid-template-columns: 1fr; }
  .week .day .m { display: flex; gap: 10px; }
  .week .day .m span { width: 76px; flex: none; padding-top: 2px; }
}

/* Grocery list */
.trips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.trips .pill { white-space: nowrap; }
.aisle h3 { font-family: var(--sans); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 6px 0 2px; }
.check { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); cursor: pointer; }
.aisle .check:first-of-type { border-top: 0; }
.check input { width: 22px; height: 22px; accent-color: var(--pill); flex: none; margin: 0; }
.check .what { flex: 1; }
.check .amt { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.check.done .what { text-decoration: line-through; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Prep + recipes */
.cook { list-style: none; margin: 0; padding: 0; }
.cook li { padding: 10px 0; border-top: 1px solid var(--line); }
.cook li:first-child { border-top: 0; }
details summary { cursor: pointer; font-weight: 600; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: ' ›'; color: var(--muted); }
details[open] summary::after { content: ' ⌄'; }
.recipe ul, .recipe ol { margin: 6px 0 0; padding-left: 20px; }
.recipe li { padding: 2px 0; }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--pill); color: var(--pill-ink); border-radius: 999px; padding: 8px 16px; font-size: 14px; z-index: 10;
}
.meals a, .cook a { text-decoration: none; }

/* Protein */
.meals .pro { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; padding-top: 18px; }
.goal { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 2px; }
.goal progress { width: 100%; height: 8px; margin-top: 8px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 99px; background: var(--fill-soft); overflow: hidden; }
.goal progress::-webkit-progress-bar { background: var(--fill-soft); border-radius: 99px; }
.goal progress::-webkit-progress-value { background: var(--green); border-radius: 99px; }
.goal progress::-moz-progress-bar { background: var(--green); }
.goal.short progress::-webkit-progress-value { background: var(--amber); }
.goal.short b { color: var(--amber); }
.week .daypro { font-size: 12px; font-weight: 650; color: var(--green); padding-top: 6px; border-top: 1px solid var(--line); }
.week .daypro.short { color: var(--amber); }
.daynav { flex-wrap: wrap; }
.cook .row .small { white-space: nowrap; }

/* Training + water */
.tag.lift { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); }
.tag.yoga { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.water progress { width: 100%; height: 8px; margin: 8px 0 4px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 99px; background: var(--fill-soft); overflow: hidden; }
.water progress::-webkit-progress-bar { background: var(--fill-soft); border-radius: 99px; }
.water progress::-webkit-progress-value { background: var(--blue); border-radius: 99px; }
.water progress::-moz-progress-bar { background: var(--blue); }
.water .check:first-of-type { border-top: 0; }
.water .check .time { width: 64px; flex: none; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.meals .name .small { font-weight: 400; margin-left: 4px; }
@media (max-width: 400px) { .tabs a { font-size: 12px; padding: 8px 2px; } }
.classes { list-style: none; margin: 0; padding: 0; }
.classes li { display: flex; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.classes li:first-child { border-top: 0; }
.classes .time { width: 64px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }

/* All: one timeline with animated filters. Items fold away by animating their grid row to 0fr, so everything below
   slides up smoothly with no measuring. */
:root { --ease: cubic-bezier(0.2, 0.8, 0.2, 1); --c-meal: var(--green); --c-train: var(--red); --c-water: var(--blue); --c-prep: var(--amber); --c-shop: var(--pill); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 7px 12px; font-size: 14px; font-weight: 550; cursor: pointer; color: var(--muted); touch-action: manipulation;
  transition: background 0.25s var(--ease), color 0.25s, border-color 0.25s, transform 0.15s var(--ease);
}
.chip:active { transform: scale(0.94); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); opacity: 0.35; transform: scale(0.7); transition: opacity 0.25s, transform 0.35s var(--ease); }
.chip .n { font-size: 12px; font-variant-numeric: tabular-nums; opacity: 0.7; }
.chip.on { color: var(--ink); border-color: color-mix(in srgb, var(--c, var(--pill)) 55%, var(--line)); background: color-mix(in srgb, var(--c, var(--pill)) 12%, var(--surface)); }
.chip.on .dot { opacity: 1; transform: scale(1); }
.chip.reset.on { background: var(--pill); color: var(--pill-ink); border-color: var(--pill); }
.chip.meal, li.meal { --c: var(--c-meal); }
.chip.train, li.train { --c: var(--c-train); }
.chip.water, li.water { --c: var(--c-water); }
.chip.prep, li.prep { --c: var(--c-prep); }
.chip.shop, li.shop { --c: var(--c-shop); }
.hint { margin: -6px 0 0; }

.fold {
  display: grid; grid-template-rows: 1fr; opacity: 1; transform: none;
  transition: grid-template-rows 0.42s var(--ease), opacity 0.3s var(--ease), transform 0.42s var(--ease);
}
.fold > div { min-height: 0; overflow: hidden; }
.fold.off { grid-template-rows: 0fr; opacity: 0; transform: translateX(-10px) scale(0.98); }
.sday.fold.off { transform: none; }
.still .fold, .still .nowline { transition: none !important; }

.sched { display: grid; }
.sday > div { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0 16px; }
.sday { margin-bottom: 12px; transition-property: grid-template-rows, opacity, margin-bottom; }
.sday.off { margin-bottom: 0; }
.sday h3 { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 4px; }
.sday ol { list-style: none; margin: 0; padding: 0 0 8px; }
.sday li > div { border-top: 1px solid var(--line); }
.sday .item { display: grid; grid-template-columns: 64px 12px 1fr; gap: 10px; align-items: start; padding: 10px 0; text-decoration: none; color: inherit; }
.sday .item .time { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.sday .item .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-top: 6px; }
.sday .item .what { display: grid; min-width: 0; }
.sday .item .what b { font-weight: 600; }
.sday li.past .item { opacity: 0.45; }
a.item:hover b { text-decoration: underline; text-underline-offset: 2px; }
.nowline { position: relative; height: 18px; display: grid; align-items: center; transition: opacity 0.3s, height 0.42s var(--ease); }
.nowline::before { content: ''; height: 2px; background: var(--red); border-radius: 2px; }
.nowline span { position: absolute; left: 0; background: var(--surface); color: var(--red); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding-right: 8px; }
.nowline.off { opacity: 0; height: 0; }
.empty p { text-align: center; padding: 28px 0 60px; }

/* Easter eggs (eggs.js) */
.eggs { position: fixed; inset: 0; z-index: 20; pointer-events: none; visibility: hidden; }
.eggs.on { visibility: visible; }
.eggs canvas { display: block; }
.shake { animation: shake 0.6s var(--ease); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px) rotate(0.3deg); }
  30%, 50%, 70% { transform: translateX(-7px) rotate(-0.4deg); } 40%, 60% { transform: translateX(7px) rotate(0.4deg); }
}

@media (prefers-reduced-motion: reduce) {
  .fold, .chip, .chip .dot, .nowline { transition: none !important; }
  .fold.off { transform: none; }
  .shake { animation: none; }
}
@media (max-width: 640px) { .tabs a { padding: 8px 2px; font-size: 12px; } }
