:root {
  color-scheme: light;
  --bg: #f3f2ee;
  --surface: #fcfcfb;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #6f6e69;
  --line: #e2e0d9;
  --grid: #ebe9e3;
  --link: #1c5cab;
  --protein: #2a78d6;
  --carbs: #eb6834;
  --fat: #1baf7a;
  --bar: #2a78d6;
  --good: #0ca30c;
  --mixed: #fab219;
  --bad: #d03b3b;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #9b9a92;
    --line: #2f2f2c;
    --grid: #262624;
    --link: #86b6ef;
    --protein: #3987e5;
    --carbs: #d95926;
    --fat: #199e70;
    --bar: #3987e5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211;
  --surface: #1a1a19;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #9b9a92;
  --line: #2f2f2c;
  --grid: #262624;
  --link: #86b6ef;
  --protein: #3987e5;
  --carbs: #d95926;
  --fat: #199e70;
  --bar: #3987e5;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: -.01em; }
p { margin: 0 0 .8em; }
small { font-size: .7em; font-weight: 500; color: var(--text-2); }
.muted { color: var(--muted); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.lede { color: var(--text-2); font-size: 1.05rem; max-width: 60ch; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .45em .5em; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--text-2); font-size: .8rem; }
.num { text-align: right; white-space: nowrap; }
.table-scroll { overflow-x: auto; }

/* Header and footer */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand img { display: block; }
.top nav { display: flex; gap: 4px; }
.top nav a { color: var(--text-2); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.top nav a[aria-current] { color: var(--text); background: var(--bg); font-weight: 600; }
.foot { color: var(--muted); font-size: .85rem; padding-top: 32px; padding-bottom: 40px; }
main { padding-top: 24px; }

/* Stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 16px 0; }
.tiles div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.tiles dt { font-size: .78rem; color: var(--text-2); }
.tiles dd { margin: 0; font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.more { font-weight: 600; }

/* Mascot notes: a character beside a speech bubble */
.mascot-note { display: flex; align-items: flex-end; gap: 6px; margin: 16px 0; max-width: 760px; }
.mascot { flex: none; width: auto; height: 120px; }
.bubble { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 28px; color: var(--text-2); font-size: .95rem; }
.bubble::before { content: ""; position: absolute; left: -8px; bottom: 18px; width: 14px; height: 14px; background: var(--surface); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(45deg); }
.bubble > :last-child { margin-bottom: 0; }
.bubble ul { padding-left: 1.2em; margin: 0; }
.bubble li { margin-bottom: .4em; }
.notes .mascot-note { margin-top: 0; }

/* Index controls */
.controls { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 24px 0 8px; }
.controls[hidden] { display: none; }
#q { flex: 1 1 220px; min-width: 0; font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font: inherit; font-size: .88rem; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; }
.chips button span { color: var(--muted); font-size: .85em; }
.chips button[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.chips button[aria-pressed="true"] span { color: inherit; opacity: .7; }
.sort { font-size: .88rem; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.sort select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.count { font-size: .85rem; min-height: 1.3em; }

/* Card grid */
.grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.card { content-visibility: auto; contain-intrinsic-size: auto 330px; }
.card[hidden] { display: none; }
.card a { display: block; color: inherit; text-decoration: none; }
.card figure { margin: 0 0 8px; position: relative; border-radius: var(--radius); overflow: hidden; background: var(--line); aspect-ratio: 4 / 5; }
.card .thumb { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.card a:hover .thumb { transform: scale(1.03); }
.card .kcal { position: absolute; left: 8px; bottom: 8px; background: rgb(0 0 0 / .72); color: #fff; font-weight: 700; padding: 2px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.card .kcal small { color: #ddd; }
.card h2 { font-size: .95rem; font-weight: 600; margin: 0 0 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card a:hover h2 { text-decoration: underline; }
.card .meta { font-size: .8rem; color: var(--muted); margin: 0 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.noimg { display: grid; place-items: center; width: 100%; height: 100%; font-size: 2rem; }

/* Macro split bar: segments separated by a 2px surface gap */
.split { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; }
.split-lg { height: 26px; border-radius: 6px; margin: 12px 0 6px; }
.seg { flex-basis: 0; min-width: 2px; }
.split-lg .seg { color: #fff; font-size: .78rem; font-weight: 600; line-height: 26px; padding: 0 8px; white-space: nowrap; overflow: hidden; }
.seg-protein { background: var(--protein); }
.seg-carbs { background: var(--carbs); }
.seg-fat { background: var(--fat); }
.legend { list-style: none; padding: 0; margin: 8px 0 0; display: flex; gap: 14px; font-size: .8rem; color: var(--text-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.grid + .legend { margin-top: 16px; }

/* Video page */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.video-head { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 28px; align-items: start; }
.player { position: sticky; top: 68px; }
.player .poster, .player iframe { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; border-radius: var(--radius); background: #000; border: 0; object-fit: cover; }
.yt { all: unset; display: block; position: relative; cursor: pointer; border-radius: var(--radius); }
.yt:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; }
.play { position: absolute; inset: 0; margin: auto; width: 68px; height: 48px; border-radius: 14px; background: rgb(0 0 0 / .7); transition: background .2s; }
.play::after { content: ""; position: absolute; left: 27px; top: 14px; border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #fff; }
.yt:hover .play { background: #f00; }
.head-text .meta { color: var(--text-2); }
.tiles-day { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.tile-kcal dd { color: var(--text); }
.summary { margin-top: 16px; }
.caption { font-size: .88rem; color: var(--text-2); margin-bottom: 12px; }
.caption summary { cursor: pointer; color: var(--link); }
.caption p { white-space: pre-line; margin: 6px 0 0; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: .9rem; text-decoration: none; color: #fff; background: var(--text-2); }
.btn-youtube { background: #c4302b; }
.btn-instagram { background: #c13584; }
.btn-tiktok { background: #111; box-shadow: inset 0 0 0 1px #444; }
.btn-quiet { background: transparent; color: var(--link); box-shadow: inset 0 0 0 1px var(--line); }
.section { font-size: 1.2rem; margin: 36px 0 12px; }
.meal { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.meal-img { width: 120px; height: 120px; border-radius: 8px; object-fit: cover; background: var(--line); }
.meal-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin-bottom: 6px; }
.meal-head h3 { font-size: 1.05rem; margin: 0; }
.meal-kcal { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.take { color: var(--text-2); }
.quip { color: var(--muted); font-style: italic; }
.items td strong { font-weight: 600; }
.serving { display: block; color: var(--muted); font-size: .82rem; }
.low { color: var(--text); font-style: normal; font-weight: 600; }
.items details { font-size: .82rem; color: var(--text-2); }
.items summary { cursor: pointer; color: var(--link); width: max-content; }
.items details p { margin: 4px 0 0; max-width: 60ch; }
.items { table-layout: fixed; }
.items thead th:not(:first-child) { width: 3.4em; }
.items thead th:nth-child(3), .items thead th:last-child { width: 3.9em; }
.items td:first-child { overflow-wrap: anywhere; }
.day-total { display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: baseline; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.day-total strong { color: var(--text); font-size: 1.1rem; margin-right: auto; }
.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 28px; }
.notes ul { padding-left: 1.2em; color: var(--text-2); }
.notes li { margin-bottom: .4em; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 32px; }
.pager a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; text-decoration: none; color: var(--text); font-weight: 600; }
.pager small { display: block; color: var(--muted); font-weight: 500; font-size: .78rem; }
.pager .older { text-align: right; }

/* Verdict badges: status colour on the icon only, with a text label */
.verdict { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; color: var(--text-2); padding: 1px 8px 1px 2px; border: 1px solid var(--line); border-radius: 999px; }
.verdict > span { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; color: #fff; font-size: .7rem; }
.verdict-good > span { background: var(--good); }
.verdict-mixed > span { background: var(--mixed); color: #0b0b0b; }
.verdict-bad > span { background: var(--bad); }

/* Stats charts */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; min-width: 0; }
.panel h2 { font-size: 1.05rem; margin-bottom: 2px; }
.panel > .muted { font-size: .85rem; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 14px; align-items: start; }
.three { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 14px; align-items: start; }
.vbars { position: relative; height: 220px; margin: 18px 0 0 34px; display: grid; grid-template-columns: repeat(var(--n), 1fr); align-items: end; border-bottom: 1px solid var(--text-2); }
.grid-lines { position: absolute; inset: 0; pointer-events: none; }
.grid-lines span { position: absolute; left: 0; right: 0; border-top: 1px solid var(--grid); }
.grid-lines b { position: absolute; right: 100%; transform: translateY(-50%); padding-right: 6px; font-size: .72rem; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.vbar-col { position: relative; height: 100%; display: flex; align-items: flex-end; padding: 0 1px; outline: none; }
.vbar { display: block; width: 100%; background: var(--bar); border-radius: 4px 4px 0 0; min-height: 0; }
.vbar-col:hover .vbar, .vbar-col:focus-visible .vbar { filter: brightness(1.15); }
.vbar-col:focus-visible { box-shadow: inset 0 0 0 2px var(--link); }
.vbar-axis { display: grid; grid-template-columns: repeat(var(--n), 1fr); margin-left: 34px; font-size: .72rem; color: var(--muted); }
.vbar-axis span { transform: translateX(-50%); white-space: nowrap; }
.table-view { margin-top: 10px; font-size: .85rem; }
.table-view summary { cursor: pointer; color: var(--link); }
.table-view table { max-width: 320px; margin-top: 6px; }
.hbars { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) 3.2em; align-items: center; gap: 10px; font-size: .88rem; outline: none; border-radius: 4px; }
.hbars li:focus-visible { box-shadow: 0 0 0 2px var(--link); }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; }
.hbar { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbars li:hover .hbar { filter: brightness(1.15); }
.hbar-good { background: var(--good); }
.hbar-mixed { background: var(--mixed); }
.hbar-bad { background: var(--bad); }
.hbar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.rank caption { text-align: left; font-weight: 650; font-size: 1.05rem; margin-bottom: 8px; }
.rank td:first-child { color: var(--muted); width: 2em; }

/* Tooltip shared by every chart mark with data-tip */
.tip[hidden] { display: none; }
.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--text); color: var(--surface); font-size: .8rem; font-weight: 500; padding: 5px 9px; border-radius: 6px; max-width: 260px; transform: translate(-50%, calc(-100% - 10px)); }

@media (max-width: 720px) {
  .video-head { grid-template-columns: 1fr; }
  .player { position: static; max-width: 280px; margin: 0 auto; }
  .meal { grid-template-columns: 1fr; }
  .mascot { height: 92px; }
  .bubble { font-size: .9rem; padding: 10px 12px; }
  .meal-img { width: 100%; height: 160px; }
  .meal { padding: 12px; }
  .items { font-size: .82rem; }
  .items .at { display: none; }
  .items thead th:not(:first-child) { width: 2.6em; }
  .items thead th:nth-child(3), .items thead th:last-child { width: 3.2em; }
  .items th, .items td { padding-left: .3em; padding-right: .3em; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .vbars { height: 180px; }
}
@media (prefers-reduced-motion: reduce) {
  .card .thumb { transition: none; }
}
@media (forced-colors: active) {
  .seg, .vbar, .hbar { forced-color-adjust: none; }
}
