/* LIUsog design system.
   Semantic colours, type and spacing follow the iOS system so the app feels native on a phone:
   grouped backgrounds, inset lists, translucent bars, sheets, system font. Sizes are in rem so
   the layout grows with the user's text-size setting. */

:root {
  color-scheme: light dark;

  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.72);
  --label-3: rgba(60, 60, 67, 0.4);
  --separator: rgba(60, 60, 67, 0.2);
  --fill: rgba(120, 120, 128, 0.2);
  --fill-2: rgba(120, 120, 128, 0.12);
  --material: rgba(249, 249, 249, 0.78);
  --scrim: rgba(0, 0, 0, 0.32);

  --tint: #007aff;
  --red: #ff3b30;
  --green: #248a3d;

  --energy: #ff9500;
  --energy-2: #ffcc00;
  --energy-text: #b25000;
  --protein: #ff2d55;
  --carb: #30b0c7;
  --fat: #5856d6;
  --body: #af52de;
  --move: #34c759;
  --move-text: #248a3d;

  --blue: #007aff; --pink: #ff2d55; --orange: #ff9500; --purple: #af52de; --teal: #30b0c7;
  --indigo: #5856d6; --mint: #00c7be; --yellow: #d4a400;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, Roboto, sans-serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;

  --radius-card: 1rem;
  --radius-control: 0.75rem;
  --gutter: 1rem;
  --tabbar-h: 3.125rem;
  --navbar-h: 2.75rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Non-gesture transitions. Gesture-driven motion (sheets) uses springs in app.js. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.68);
    --label-3: rgba(235, 235, 245, 0.34);
    --separator: rgba(84, 84, 88, 0.6);
    --fill: rgba(120, 120, 128, 0.36);
    --fill-2: rgba(120, 120, 128, 0.24);
    --material: rgba(29, 29, 31, 0.78);
    --scrim: rgba(0, 0, 0, 0.5);

    --tint: #0a84ff;
    --red: #ff453a;
    --green: #30d158;
    --energy: #ff9f0a;
    --energy-2: #ffd60a;
    --energy-text: #ff9f0a;
    --protein: #ff375f;
    --carb: #40c8e0;
    --fat: #7d7aff;
    --body: #bf5af2;
    --move: #30d158;
    --move-text: #30d158;

    --blue: #0a84ff; --pink: #ff375f; --orange: #ff9f0a; --purple: #bf5af2; --teal: #40c8e0;
    --indigo: #5e5ce6; --mint: #63e6e2; --yellow: #ffd60a;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font: 100%/1.3 var(--font);
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  color: var(--label);
  background: var(--bg);
  font-size: 1.0625rem;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--tint); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
svg { display: block; }
[hidden] { display: none !important; }

.icon { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 1.125rem; height: 1.125rem; stroke-width: 2; }
.icon.fill { fill: currentColor; stroke: none; }
.num { font-family: var(--font-rounded); font-variant-numeric: tabular-nums; }
.secondary { color: var(--label-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ------------------------------------------------------------------ app frame */
.app {
  max-width: 30rem;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  transform-origin: 50% 0;
  will-change: transform;
}

.navbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--navbar-h) + var(--safe-top));
  padding: var(--safe-top) 0.5rem 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
}
/* The material sits on a pseudo-element so it can fade in once content scrolls under the bar,
   instead of a hard divider that is always there. */
.navbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
  opacity: 0; transition: opacity 180ms ease;
}
.navbar.is-stuck::before { opacity: 1; }
.navbar-title {
  font-size: 1.0625rem; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity 180ms ease;
}
.navbar.is-stuck .navbar-title, .navbar.is-plain .navbar-title { opacity: 1; }
.navbar-start { display: flex; justify-content: flex-start; }
.navbar-end { display: flex; justify-content: flex-end; gap: 0.25rem; }
.nav-btn {
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.5rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.125rem;
  color: var(--tint); font-size: 1.0625rem; border-radius: 0.75rem;
}
.nav-btn.strong { font-weight: 600; }
.nav-btn:active { opacity: 0.45; }
.nav-btn .icon { width: 1.375rem; height: 1.375rem; stroke-width: 2.2; }

.screen {
  padding: 0 var(--gutter) calc(var(--tabbar-h) + var(--safe-bottom) + 2rem);
}
.screen.no-tabbar { padding-bottom: calc(var(--safe-bottom) + 2rem); }

.eyebrow {
  font-size: 0.8125rem; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: 0.02em;
}
.large-title {
  font-size: 2.125rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.022em;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.section-title { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.012em; margin: 1.75rem 0 0.625rem; display: flex; align-items: baseline; justify-content: space-between; }
.section-title a { font-size: 1.0625rem; font-weight: 400; letter-spacing: 0; }
.group-header { font-size: 0.8125rem; color: var(--label-2); text-transform: uppercase; letter-spacing: 0.02em; margin: 1.5rem 1rem 0.4375rem; }
.group-footer { font-size: 0.8125rem; color: var(--label-2); margin: 0.4375rem 1rem 0; line-height: 1.38; }

/* ------------------------------------------------------------------ tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
  padding-bottom: var(--safe-bottom);
}
.tabbar-inner { max-width: 30rem; margin: 0 auto; height: var(--tabbar-h); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.125rem;
  color: var(--label-2); font-size: 0.625rem; font-weight: 500; letter-spacing: 0.01em;
}
.tab .icon { width: 1.625rem; height: 1.625rem; }
.tab[aria-current="page"] { color: var(--tint); }
.tab[aria-current="page"] .icon { fill: currentColor; fill-opacity: 0.16; }
.tab:active { opacity: 0.55; }

/* ------------------------------------------------------------------ cards and lists */
.card {
  background: var(--surface); border-radius: var(--radius-card); padding: 1rem;
  display: block; color: inherit;
}
.card + .card { margin-top: 0.75rem; }
a.card:active, button.card:active { background: var(--surface-2); }
.card-head {
  display: flex; align-items: center; gap: 0.375rem;
  font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.75rem;
}
.card-head .chev { margin-left: auto; color: var(--label-3); display: flex; align-items: center; gap: 0.25rem; font-weight: 400; font-size: 0.875rem; }
.t-energy { color: var(--energy-text); }
.t-body { color: var(--body); }
.t-tint { color: var(--tint); }
.t-green { color: var(--green); }

.metric { font-family: var(--font-rounded); font-weight: 700; font-size: 2.125rem; line-height: 1.05; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
.metric small { font-family: var(--font); font-size: 1rem; font-weight: 600; color: var(--label-2); letter-spacing: 0; margin-left: 0.125rem; }
.metric.md { font-size: 1.75rem; }

.group { background: var(--surface); border-radius: var(--radius-card); overflow: hidden; }
.group + .group { margin-top: 1.25rem; }
.row {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  min-height: 2.75rem; padding: 0.6875rem 1rem; position: relative;
  color: inherit; text-align: left; background: var(--surface);
}
.row + .row::before, .row + form > .row::before, form + .row::before {
  content: ""; position: absolute; top: 0; right: 0; left: 1rem; height: 0.5px; background: var(--separator);
}
.row.inset-sep + .row::before { left: 3.75rem; }
a.row:active, button.row:active { background: var(--fill-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { display: block; font-size: 0.8125rem; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 0.0625rem; }
.row-value { color: var(--label-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-chev { color: var(--label-3); margin-right: -0.25rem; }
.row .tint { color: var(--tint); }
.row.destructive { color: var(--red); justify-content: center; }
.row.center { justify-content: center; color: var(--tint); }

/* Form rows: label on the left, control on the right, like Settings. */
.field { display: flex; align-items: center; gap: 0.75rem; min-height: 2.75rem; padding: 0 1rem; position: relative; background: var(--surface); }
.field + .field::before { content: ""; position: absolute; top: 0; right: 0; left: 1rem; height: 0.5px; background: var(--separator); }
.field > label, .field > .field-label { flex: none; min-width: 6.5rem; }
.field input, .field select {
  flex: 1; min-width: 0; height: 2.75rem; border: 0; background: transparent; outline: none;
  text-align: right; color: var(--label); -webkit-appearance: none; appearance: none; border-radius: 0;
}
.field input::placeholder { color: var(--label-3); }
.field select { color: var(--tint); text-align-last: right; padding-right: 0; }
.field input[type="date"] { color: var(--tint); min-width: 8rem; }
.field .unit { color: var(--label-2); flex: none; }
.field.left input { text-align: left; }
.field-error { color: var(--red); font-size: 0.8125rem; margin: 0.4375rem 1rem 0; }
.field:focus-within > label { color: var(--tint); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem; width: 100%;
  min-height: 3.125rem; padding: 0 1.25rem; border-radius: 0.875rem;
  background: var(--tint); color: #fff; font-weight: 600; font-size: 1.0625rem;
  transition: transform 120ms var(--ease-out), opacity 120ms ease;
}
.btn:active { transform: scale(0.97); opacity: 0.85; transition-duration: 0ms; }
.btn.tinted { background: color-mix(in srgb, var(--tint) 14%, transparent); color: var(--tint); }
.btn.gray { background: var(--fill-2); color: var(--tint); }
.btn.sm { min-height: 2.125rem; width: auto; padding: 0 0.875rem; border-radius: 1.0625rem; font-size: 0.9375rem; }
.btn.destructive { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.btn-plain { color: var(--tint); font-size: 1.0625rem; min-height: 2.75rem; padding: 0 0.5rem; }
.btn-plain.strong { font-weight: 600; }
.btn-plain:active { opacity: 0.45; }
.icon-btn {
  width: 1.875rem; height: 1.875rem; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--fill-2); color: var(--tint);
  transition: transform 120ms var(--ease-out);
}
.icon-btn:active { transform: scale(0.9); transition-duration: 0ms; background: var(--fill); }
.icon-btn .icon { width: 1.0625rem; height: 1.0625rem; stroke-width: 2.6; }
/* A 30px visual with a 44px touch target. */
.icon-btn { position: relative; }
.icon-btn::after { content: ""; position: absolute; inset: -0.4375rem; }

.avatar {
  --c: var(--blue);
  width: 2.25rem; height: 2.25rem; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 78%, #fff), var(--c));
  color: #fff; font-weight: 600; font-size: 0.875rem; letter-spacing: 0.01em;
}
.avatar.lg { width: 3.5rem; height: 3.5rem; font-size: 1.25rem; }
.avatar.xl { width: 5.5rem; height: 5.5rem; font-size: 2rem; }
.c-blue { --c: var(--blue); } .c-pink { --c: var(--pink); } .c-green { --c: #34c759; } .c-orange { --c: var(--orange); }
.c-purple { --c: var(--purple); } .c-teal { --c: var(--teal); } .c-indigo { --c: var(--indigo); } .c-red { --c: var(--red); }
.c-mint { --c: var(--mint); } .c-yellow { --c: var(--yellow); }

/* ------------------------------------------------------------------ rings and bars */
.ring { display: block; flex: none; }
.ring-track { stroke: var(--ring-color); opacity: 0.2; }
.ring-value {
  stroke: var(--ring-color);
  transform: rotate(-90deg); transform-origin: 50% 50%;
  animation: ring-fill 900ms var(--ease-out) both;
}
.ring.energy { --ring-color: var(--energy); }
.ring.body { --ring-color: var(--body); }
.ring.tint { --ring-color: var(--tint); }
@keyframes ring-fill { from { stroke-dashoffset: var(--ring-c); } }

.ring-wrap { position: relative; flex: none; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }

.hero { display: flex; align-items: center; gap: 1.25rem; }
.hero-stats { flex: 1; min-width: 0; }
.hero-stats .caption { font-size: 0.8125rem; color: var(--label-2); margin-top: 0.375rem; line-height: 1.4; }

.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.875rem; margin-top: 1.125rem; }
.macro-label { font-size: 0.75rem; font-weight: 600; color: var(--label-2); }
.macro-value { font-family: var(--font-rounded); font-weight: 600; font-size: 0.9375rem; white-space: nowrap; font-variant-numeric: tabular-nums; margin: 0.125rem 0 0.375rem; }
.macro-value span { color: var(--label-2); font-weight: 500; }
.bar { height: 0.375rem; border-radius: 0.1875rem; background: color-mix(in srgb, var(--bar) 20%, transparent); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--bar); transform-origin: 0 50%; animation: bar-fill 700ms var(--ease-out) both; }
.bar.tint { --bar: var(--tint); } .bar.done { --bar: var(--move); }
.bar.protein { --bar: var(--protein); } .bar.carb { --bar: var(--carb); } .bar.fat { --bar: var(--fat); }
@keyframes bar-fill { from { transform: scaleX(0); } }

/* Week strip: one small ring per day, like the Fitness app's week header. */
.week { display: grid; grid-template-columns: repeat(7, 1fr); margin: 0 -0.25rem 1rem; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 0.375rem; padding: 0.25rem 0; color: var(--label); border-radius: 0.75rem; }
.week-day .letter {
  width: 1.5rem; height: 1.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.6875rem; font-weight: 600; color: var(--label-2);
}
.week-day.is-today .letter { color: var(--tint); }
.week-day.selected .letter { background: var(--label); color: var(--bg); }
.week-day.selected.is-today .letter { background: var(--tint); color: #fff; }
.week-day.future { opacity: 0.35; pointer-events: none; }
.week-day:active { opacity: 0.55; }

.spark { stroke: var(--body); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.chart { width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--separator); stroke-width: 0.5; }
.chart .axis { fill: var(--label-2); font-size: 10px; font-family: var(--font); }
.chart .area { fill: var(--body); opacity: 0.12; }
.chart .trend { stroke: var(--body); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { fill: var(--body); opacity: 0.35; }
.chart .last { fill: var(--surface); stroke: var(--body); stroke-width: 2.5; }

/* ------------------------------------------------------------------ controls */
.search {
  display: flex; align-items: center; gap: 0.375rem; height: 2.25rem; padding: 0 0.5rem;
  background: var(--fill-2); border-radius: 0.625rem; color: var(--label-2);
}
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; height: 100%; color: var(--label); -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--label-2); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-row { display: flex; align-items: center; gap: 0.5rem; position: sticky; top: calc(var(--navbar-h) + var(--safe-top)); z-index: 10; background: var(--bg); padding: 0.25rem 0 0.625rem; }
.search-row .search { flex: 1; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--fill-2); border-radius: 0.5625rem; padding: 0.125rem; position: relative; margin-bottom: 1rem; }
.segmented button { position: relative; z-index: 1; height: 1.875rem; font-size: 0.8125rem; font-weight: 500; border-radius: 0.4375rem; }
.segmented button[aria-selected="true"] { font-weight: 600; }
.segmented .thumb {
  position: absolute; top: 0.125rem; bottom: 0.125rem; left: 0.125rem; width: calc((100% - 0.25rem) / var(--n));
  background: var(--surface); border-radius: 0.4375rem;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
  transform: translateX(calc(var(--i) * 100%)); transition: transform 260ms var(--ease-out);
}
@media (prefers-color-scheme: dark) { .segmented .thumb { background: #636366; } }

.stepper { display: inline-flex; align-items: center; background: var(--fill-2); border-radius: 0.5rem; flex: none; }
.stepper button { width: 2.9375rem; height: 2rem; display: flex; align-items: center; justify-content: center; }
.stepper button:active { background: var(--fill); }
.stepper button:first-child { border-radius: 0.5rem 0 0 0.5rem; }
.stepper button:last-child { border-radius: 0 0.5rem 0.5rem 0; }
.stepper i { width: 1px; height: 1.125rem; background: var(--separator); }
.stepper .icon { width: 1.125rem; height: 1.125rem; stroke-width: 2.4; }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.625rem; margin-bottom: 1.25rem; }
.action {
  background: var(--surface); border-radius: 0.875rem; padding: 0.75rem 0.5rem; min-height: 4.25rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3125rem;
  color: var(--tint); font-size: 0.8125rem; font-weight: 500; text-align: center; cursor: pointer;
  transition: transform 120ms var(--ease-out);
}
.action:active { transform: scale(0.96); background: var(--fill-2); transition-duration: 0ms; }

.empty { text-align: center; padding: 2.5rem 1.5rem; color: var(--label-2); }
.empty h3 { color: var(--label); font-size: 1.25rem; font-weight: 700; margin-bottom: 0.375rem; }
.empty p { font-size: 0.9375rem; line-height: 1.4; }
.empty .btn { margin-top: 1.25rem; }

.family-strip { display: flex; gap: 1rem; overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 0.125rem var(--gutter); scrollbar-width: none; }
.family-strip::-webkit-scrollbar { display: none; }
.member { display: flex; flex-direction: column; align-items: center; gap: 0.375rem; color: var(--label); font-size: 0.75rem; flex: none; width: 3.75rem; }
.member:active { opacity: 0.55; }
.member-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.banner { display: flex; align-items: center; gap: 0.625rem; padding: 0.625rem 0.875rem; background: color-mix(in srgb, var(--tint) 12%, var(--surface)); border-radius: 0.875rem; font-size: 0.9375rem; margin-bottom: 0.75rem; }

/* ------------------------------------------------------------------ sheets */
#sheet-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#sheet-root.open { pointer-events: auto; }
.scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 30rem;
  max-height: calc(100dvh - var(--safe-top) - 2.5rem);
  background: var(--bg); border-radius: 0.875rem 0.875rem 0 0;
  display: flex; flex-direction: column;
  transform: translateY(100%); will-change: transform;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
  /* Extends below the screen so a springy overshoot never shows a gap under the sheet. */
  padding-bottom: 0;
}
.sheet::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 50vh; background: var(--bg); }
.sheet-handle { touch-action: none; cursor: grab; flex: none; }
.sheet-grabber { width: 2.25rem; height: 0.3125rem; border-radius: 0.1875rem; background: var(--label-3); margin: 0.3125rem auto 0; }
.sheet-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0.125rem 0.5rem 0.25rem; min-height: 2.75rem; }
.sheet-header h2 { font-size: 1.0625rem; font-weight: 600; text-align: center; }
.sheet-header > :first-child { justify-self: start; }
.sheet-header > :last-child { justify-self: end; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0.5rem var(--gutter) calc(var(--safe-bottom) + 1.25rem); }
html.sheet-open, html.sheet-open body { background: #000; }
html.sheet-open .app { border-radius: 0.75rem; overflow: hidden; }

.portion-hero { text-align: center; padding: 0.5rem 0 1.25rem; }
.portion-hero .food-name { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.portion-hero .food-brand { color: var(--label-2); font-size: 0.9375rem; margin-top: 0.125rem; }
.portion-hero .metric { font-size: 3rem; margin-top: 0.875rem; color: var(--energy-text); }
.portion-macros { display: flex; justify-content: center; gap: 1.5rem; margin-top: 0.625rem; font-size: 0.8125rem; color: var(--label-2); }
.portion-macros b { font-family: var(--font-rounded); color: var(--label); font-weight: 600; font-size: 1.0625rem; display: block; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; margin-right: 0.25rem; }
.dot.protein { background: var(--protein); } .dot.carb { background: var(--carb); } .dot.fat { background: var(--fat); }
.qty { display: flex; align-items: center; gap: 0.75rem; flex: 1; justify-content: flex-end; }
.qty input { width: 4.5rem; flex: none; font-family: var(--font-rounded); font-weight: 600; font-variant-numeric: tabular-nums; }
.source-note { font-size: 0.75rem; color: var(--label-2); text-align: center; margin-top: 1rem; }
.fav { color: var(--label-3); min-width: 2.75rem; min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; }
.fav.on { color: var(--energy); }
.fav.on .icon { fill: currentColor; }

/* ------------------------------------------------------------------ training */
.ring.move { --ring-color: var(--move); }
.t-move { color: var(--move-text); }
.switch { position: relative; flex: none; width: 3.1875rem; height: 1.9375rem; }
.switch input {
  -webkit-appearance: none; appearance: none; width: 100%; height: 100%; margin: 0; border-radius: 1rem; cursor: pointer;
  background: var(--fill); transition: background 200ms ease; flex: none;
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 1.6875rem; height: 1.6875rem; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06); transition: transform 220ms var(--ease-out);
}
.switch input:checked { background: #34c759; }
.switch input:checked::after { transform: translateX(1.25rem); }
.row.question { align-items: center; padding-block: 0.75rem; }
.row.question .row-main { white-space: normal; line-height: 1.3; }

.chips { display: flex; gap: 0.5rem; overflow-x: auto; margin: 0 calc(var(--gutter) * -1) 0.875rem; padding: 0 var(--gutter); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 2rem; padding: 0 0.875rem; border-radius: 1rem; display: inline-flex; align-items: center;
  background: var(--surface); color: var(--label); font-size: 0.9375rem; font-weight: 500; text-transform: capitalize;
}
.chip[aria-current="true"] { background: var(--label); color: var(--bg); }
.chip:active { opacity: 0.6; }
.tag { display: inline-flex; align-items: center; height: 1.5rem; padding: 0 0.5rem; border-radius: 0.375rem; background: var(--fill-2); font-size: 0.75rem; font-weight: 600; color: var(--label-2); text-transform: capitalize; }
.tags { display: flex; flex-wrap: wrap; gap: 0.375rem; }

.thumb { width: 3.25rem; height: 3.25rem; border-radius: 0.625rem; object-fit: cover; background: var(--fill-2); flex: none; }
.xcard { padding: 0.875rem 1rem 1rem; }
.xcard + .xcard { margin-top: 0.75rem; }
.xcard-head { display: flex; align-items: center; gap: 0.75rem; width: 100%; text-align: left; }
.xcard-head .row-title { font-weight: 600; white-space: normal; line-height: 1.2; }
.xcard.complete .xcard-check { color: #34c759; }
.xcard-check { color: var(--label-3); flex: none; }
.xcard-check .icon { width: 1.625rem; height: 1.625rem; }
.aim { margin-top: 0.75rem; padding: 0.625rem 0.75rem; border-radius: 0.75rem; background: color-mix(in srgb, var(--tint) 10%, transparent); font-size: 0.9375rem; line-height: 1.35; }
.aim b { font-family: var(--font-rounded); font-weight: 700; color: var(--tint); }
.aim .secondary { display: block; font-size: 0.8125rem; margin-top: 0.125rem; }
.last-time { font-size: 0.8125rem; color: var(--label-2); margin-top: 0.5rem; }
.sets { margin-top: 0.625rem; }
.set-row { display: flex; align-items: center; gap: 0.75rem; min-height: 2.5rem; border-top: 0.5px solid var(--separator); font-variant-numeric: tabular-nums; }
.set-no { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--fill-2); display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: var(--label-2); flex: none; }
.set-row .value { flex: 1; font-family: var(--font-rounded); font-weight: 600; }
.set-form { display: flex; align-items: flex-end; gap: 0.5rem; margin-top: 0.75rem; }
.set-form label { flex: 1; min-width: 0; font-size: 0.6875rem; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: 0.03em; }
.set-form input {
  display: block; width: 100%; height: 2.75rem; margin-top: 0.25rem; border: 0; border-radius: 0.625rem; background: var(--fill-2); outline: none;
  text-align: center; font-family: var(--font-rounded); font-weight: 600; font-size: 1.1875rem; color: var(--label); -webkit-appearance: none; appearance: none;
}
.set-form input:focus { box-shadow: 0 0 0 2px var(--tint); }
.set-form .btn { flex: 1.2; min-height: 2.75rem; border-radius: 0.625rem; }
.plain-list { margin: 0; padding: 0; list-style: none; }
.plain-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; padding: 0.5rem 0; border-top: 0.5px solid var(--separator); }
.plain-list li:first-child { border-top: 0; }
.plain-list .detail { color: var(--label-2); font-size: 0.8125rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.plain-list li.stack { display: block; }
.plain-list li.stack .detail { white-space: normal; display: block; margin-top: 0.125rem; line-height: 1.35; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; margin-top: 0.875rem; }
.btn-row:has(> [hidden]) { grid-template-columns: 1fr; }
.btn-row .btn { font-size: 0.9375rem; padding: 0 0.5rem; white-space: nowrap; }
.steps { margin: 0; padding-left: 1.25rem; line-height: 1.45; }
.steps li { margin-bottom: 0.625rem; }
.demo { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 1rem; }
.demo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 0.75rem; background: var(--fill-2); }
.mini { width: 3.25rem; flex: none; }
.mini input { width: 100%; height: 2.25rem; border: 0; border-radius: 0.5rem; background: var(--fill-2); text-align: center; font-family: var(--font-rounded); font-weight: 600; color: var(--label); outline: none; -webkit-appearance: none; appearance: none; }
.mini span { display: block; text-align: center; font-size: 0.6875rem; color: var(--label-2); margin-top: 0.125rem; }

.rank { width: 1.5rem; text-align: center; font-family: var(--font-rounded); font-weight: 700; color: var(--label-2); flex: none; }
.rank.r1 { color: #d4a400; } .rank.r2 { color: #8e8e93; } .rank.r3 { color: #b0683a; }

/* ------------------------------------------------------------------ blood work */
.flag { flex: none; height: 1.375rem; padding: 0 0.5rem; border-radius: 0.6875rem; display: inline-flex; align-items: center; font-size: 0.75rem; font-weight: 600; }
.flag.out { background: color-mix(in srgb, var(--energy) 18%, transparent); color: var(--energy-text); }
.flag.ok { background: color-mix(in srgb, var(--move) 16%, transparent); color: var(--move-text); }
.lab-row { padding: 0.75rem 1rem; position: relative; }
.lab-row + .lab-row::before { content: ""; position: absolute; top: 0; right: 0; left: 1rem; height: 0.5px; background: var(--separator); }
.lab-row > label { display: block; font-weight: 500; margin-bottom: 0.5rem; }
.lab-inputs { display: flex; align-items: center; gap: 0.5rem; }
.lab-inputs + .lab-inputs { margin-top: 0.5rem; }
.lab-inputs input, .lab-inputs select {
  flex: 1; min-width: 0; height: 2.375rem; border: 0; border-radius: 0.5rem; background: var(--fill-2); padding: 0 0.625rem; outline: none;
  color: var(--label); -webkit-appearance: none; appearance: none; font-variant-numeric: tabular-nums;
}
.lab-inputs select { flex: none; width: 6.5rem; color: var(--tint); }
.lab-inputs input:focus { box-shadow: 0 0 0 2px var(--tint); }
.lab-inputs .lab-unit { flex: none; width: 6.5rem; color: var(--label-2); font-size: 0.9375rem; }
.lab-inputs.range { font-size: 0.8125rem; color: var(--label-2); }
.lab-inputs.range input { height: 2rem; font-size: 0.9375rem; }
.chart.lab .band { fill: var(--move); opacity: 0.14; }
.chart.lab .trend { stroke: var(--pink); }
.chart.lab .pt { fill: var(--pink); stroke: var(--surface); stroke-width: 2; }
.chart.lab .pt.out { fill: var(--energy); }

.radio { width: 1.375rem; height: 1.375rem; flex: none; accent-color: var(--tint); margin: 0; }
.notes { display: block; width: 100%; border: 0; background: transparent; padding: 0.75rem 1rem; outline: none; resize: vertical; color: var(--label); line-height: 1.4; -webkit-appearance: none; appearance: none; }
.notes::placeholder { color: var(--label-3); }
.spinner { width: 2rem; height: 2rem; margin: 0 auto; border-radius: 50%; border: 3px solid var(--fill); border-top-color: var(--tint); animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.actions.four { grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.actions.four .action { font-size: 0.75rem; padding-inline: 0.25rem; }
.copybox { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8125rem; background: var(--fill-2); border-radius: 0.5rem; padding: 0.625rem 0.75rem; word-break: break-all; user-select: all; -webkit-user-select: all; }

/* ------------------------------------------------------------------ the mark and loading
   The app icon in the app's colours (templates/partials/mark.html): the steps rise one by one,
   then the heart appears pixel by pixel and beats. Full-size on the loading screen and the AI
   "Working" page, small in the nav bar while a slow request runs. */
.mark { display: block; width: 5.5rem; height: 5.5rem; }
.mark-step { fill: var(--tint); transform-origin: 48px 76px; transform: scaleY(0); animation: mark-rise 320ms var(--ease-out) forwards; }
.mark-step:nth-child(1) { animation-delay: 100ms; } .mark-step:nth-child(2) { animation-delay: 220ms; }
.mark-step:nth-child(3) { animation-delay: 340ms; } .mark-step:nth-child(4) { animation-delay: 460ms; }
.mark-heart { transform-origin: 70px 30px; animation: mark-beat 1600ms steps(1, end) 1100ms infinite; }
.mark-heart rect { fill: var(--protein); opacity: 0; animation: mark-pop 1ms steps(1, end) forwards; }
.mark-heart rect:nth-child(1) { animation-delay: 700ms; } .mark-heart rect:nth-child(2) { animation-delay: 760ms; }
.mark-heart rect:nth-child(3) { animation-delay: 820ms; } .mark-heart rect:nth-child(4) { animation-delay: 880ms; }
.mark-heart rect:nth-child(5) { animation-delay: 940ms; }
@keyframes mark-rise { to { transform: scaleY(1); } }
@keyframes mark-pop { to { opacity: 1; } }
@keyframes mark-beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.25); } 24% { transform: scale(1); } 36% { transform: scale(1.12); } 48% { transform: scale(1); } }
@keyframes mark-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.splash { display: none; position: fixed; inset: 0; z-index: 90; background: var(--bg); flex-direction: column; align-items: center; justify-content: center; gap: 0.875rem; transition: opacity 250ms ease; }
html.booting .splash { display: flex; }
.splash.is-done { opacity: 0; pointer-events: none; }
.splash-word { font-weight: 800; font-size: 1.375rem; letter-spacing: -0.03em; opacity: 0; animation: mark-up 500ms var(--ease-out) 800ms forwards; }
.splash-word span { color: var(--tint); }
.working .mark { margin: 0 auto; }

.navbar-pulse { position: absolute; left: 50%; top: calc(var(--safe-top) + var(--navbar-h) / 2); transform: translate(-50%, -50%); opacity: 0; pointer-events: none; transition: opacity 150ms ease; }
.navbar-pulse .mark { width: 1.5rem; height: 1.5rem; }
.navbar-pulse .mark-step { animation: none; transform: none; }
.navbar-pulse .mark-heart rect { animation: none; opacity: 1; }
.navbar-pulse .mark-heart { animation: mark-beat 1200ms steps(1, end) infinite; }
html.is-busy .navbar-pulse { opacity: 1; }
html.is-busy .navbar-title { opacity: 0; }
.banner.news b { font-weight: 600; }

/* ------------------------------------------------------------------ buddy (apps/pet) */
.px { display: block; shape-rendering: crispEdges; }
.stage { position: relative; border-radius: var(--radius-control); overflow: hidden; background: var(--fill-2); display: flex; justify-content: center; }
.stage .px { height: 100%; width: auto; }
.stage.sm { width: 5.5rem; height: 6.75rem; flex: none; }
.stage.big { height: 15rem; border-radius: var(--radius-card); background: var(--surface); }
.stage.plain { background: var(--surface); }
.avatar .px.face { width: 100%; height: 100%; border-radius: 50%; }
.status-line { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875rem; color: var(--label-2); }
.bracket { display: flex; align-items: center; gap: 0.125rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875rem; color: var(--label-3); margin-top: 0.25rem; }
.bracket span { display: flex; gap: 0.125rem; flex: 1; }
.bracket i { flex: 1; height: 0.5rem; background: var(--fill); border-radius: 1px; }
.bracket i.f { background: var(--label); }
.buddy-pills { display: flex; align-items: center; gap: 0.625rem; margin-top: 0.5rem; font-size: 0.8125rem; color: var(--label-2); }
.pill { display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; }
.pill b { color: var(--label); font-weight: 600; }
.pandesal { width: 1rem; height: 1rem; flex: none; }
.badge-count { position: absolute; top: 0.125rem; right: 0; min-width: 1rem; height: 1rem; padding: 0 0.25rem; border-radius: 0.5rem; background: var(--red); color: #fff; font-size: 0.6875rem; font-weight: 600; line-height: 1rem; text-align: center; }
.nav-btn { position: relative; }
.goal-dot { display: inline-block; width: 1.125rem; height: 1.125rem; border-radius: 50%; border: 1.5px solid var(--label-3); }
.chips button.chip, .chips a.chip { font: inherit; }
.chip.outline { background: none; border: 0.5px solid var(--separator); }
.chip.outline[aria-current="true"] { background: var(--label); color: var(--bg); border-color: transparent; }
.dots { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0 0.25rem; }
.dot-btn { width: 1.375rem; height: 1.375rem; border-radius: 50%; border: 0.5px solid var(--separator); flex: none; }
.dot-btn.sm { width: 1.125rem; height: 1.125rem; }
.dot-btn.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--tint); }
.pgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.pc { position: relative; aspect-ratio: 1; background: var(--surface); border-radius: var(--radius-control); display: flex; align-items: center; justify-content: center; padding: 0.625rem; color: var(--label); }
.pc .px { width: 100%; height: 100%; }
.pc.on { outline: 2px solid var(--tint); outline-offset: -2px; }
.pc.lock { opacity: 0.4; }
.pc.owned { opacity: 0.55; }
.pc .none { font-size: 1.25rem; color: var(--label-3); }
.pc .pr { position: absolute; right: 0.375rem; bottom: 0.25rem; display: inline-flex; align-items: center; gap: 0.125rem; font-family: var(--font-rounded); font-size: 0.6875rem; font-weight: 600; color: var(--label-2); }
.pc .pr .pandesal { width: 0.75rem; height: 0.75rem; }
.pc .pr .icon { width: 0.875rem; height: 0.875rem; color: var(--green); }
.pc:active { transform: scale(0.96); transition-duration: 0ms; }
.row.unread .row-title::before { content: ""; display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--tint); margin-right: 0.375rem; vertical-align: 0.125rem; }
.avatar.c-welcome, .avatar.c-badge, .avatar.c-house, .avatar.c-fame { --c: var(--energy); } .avatar.c-bell { --c: var(--tint); }

/* Missions, stats and Town */
.buddy-title { text-align: center; font-size: 0.8125rem; font-weight: 600; color: var(--energy-text); margin-top: 0.25rem; }
.bar.rainbow { --bar: var(--tint); background: color-mix(in srgb, var(--tint) 14%, transparent); }
.bar.rainbow > i { background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #c77dff); }
.energy-bar { --bar: var(--energy); }
.month-card { text-align: center; margin-top: 0.5rem; }
.month-badge { width: 3.5rem; height: 3.5rem; margin: 0.625rem auto 0.25rem; }
.month-goal { font-weight: 700; font-size: 1.0625rem; margin-bottom: 0.25rem; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 0.75rem; }
.podium .place { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 0.125rem; font-size: 0.75rem; width: 4.5rem; }
.podium .podium-buddy { width: 3.25rem; height: 4.5rem; display: flex; align-items: flex-end; justify-content: center; }
.podium .podium-buddy .px { width: 100%; height: 100%; }
.podium .podium-buddy.empty { color: var(--label-3); font-size: 1.5rem; font-weight: 700; align-items: center; }
.podium .step { width: 100%; background: var(--fill-2); border-radius: 0.5rem 0.5rem 0 0; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--label-2); }
.podium .p1 .step { height: 2.5rem; background: color-mix(in srgb, var(--energy) 25%, var(--fill-2)); }
.podium .p2 .step { height: 1.875rem; }
.podium .p3 .step { height: 1.25rem; }
.mission-row { align-items: center; padding-block: 0.625rem; }
.mission-row .row-main { white-space: normal; }
.mission-row .row-sub { white-space: normal; }
.btn.claim { flex: none; }
.tier-gem { display: inline-block; flex: none; width: 1.125rem; height: 1.125rem; transform: rotate(45deg); border-radius: 0.25rem; background: transparent; box-shadow: inset 0 0 0 1.5px var(--label-3); margin: 0 0.25rem; }
.tier-gem[class*=" t"] { box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.15); }
.tier-gem.t0 { background: transparent; box-shadow: inset 0 0 0 1.5px var(--label-3); }
.tier-gem.t1 { background: linear-gradient(135deg, #f4f5f8, #aeb3be); } .tier-gem.t2 { background: #c98a5a; } .tier-gem.t3 { background: #7fc96b; }
.tier-gem.t4 { background: #f2c94c; } .tier-gem.t5 { background: linear-gradient(135deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #c77dff); }
.tier-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; font-size: 0.75rem; color: var(--label-2); margin: 0.75rem 1rem 0; text-transform: capitalize; }
.tier-legend span { display: inline-flex; align-items: center; gap: 0.25rem; }
.tier-legend .tier-gem { width: 0.75rem; height: 0.75rem; }
.star { width: 1.375rem; height: 1.375rem; }
.star-count { display: inline-flex; align-items: center; gap: 0.125rem; font-family: var(--font-rounded); font-weight: 600; color: var(--label-2); }
.star-count .star { width: 1rem; height: 1rem; }
.star-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.375rem 0.25rem; text-align: center; margin-top: 0.75rem; }
.star-cal .dow { font-size: 0.6875rem; font-weight: 600; color: var(--label-3); }
.star-cal .cell { display: flex; flex-direction: column; align-items: center; gap: 0.125rem; }
.star-cal .cell small { font-size: 0.625rem; color: var(--label-2); }
.star-cal .cell.today small { color: var(--tint); font-weight: 700; }
.star-cal .cell.future { opacity: 0.35; }
.week-bars { position: relative; display: flex; align-items: flex-end; gap: 0.5rem; height: 6rem; margin-top: 0.875rem; }
.week-bars i { flex: 1; min-height: 2px; background: var(--label); border-radius: 0.25rem 0.25rem 0.125rem 0.125rem; }
.week-bars .goal-line { position: absolute; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #c77dff); }
.week-bars-labels { display: flex; gap: 0.5rem; margin-top: 0.25rem; }
.week-bars-labels span { flex: 1; text-align: center; font-size: 0.6875rem; color: var(--label-2); }
.week-bars-labels .today { color: var(--tint); font-weight: 700; }
.town-card { padding-bottom: 0.875rem; }
.town-card + .town-card { margin-top: 0.875rem; }
.ground { position: relative; display: flex; align-items: flex-end; gap: 0.5rem; min-height: 9.5rem; margin: 0.5rem calc(var(--gutter) * -1) 0; padding: 0 var(--gutter) 1.125rem;
  background: linear-gradient(to bottom, transparent 0, transparent calc(100% - 1.375rem), #7cc36b calc(100% - 1.375rem), #7cc36b calc(100% - 0.75rem), #8a5a3c calc(100% - 0.75rem)); overflow-x: auto; scrollbar-width: none; }
.ground::-webkit-scrollbar { display: none; }
.ground .house { flex: none; width: 7.5rem; margin-bottom: -0.125rem; }
.ground .house .px { width: 100%; height: auto; }
.residents { display: flex; align-items: flex-end; gap: 0.125rem; }
.resident { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; width: 3.5rem; color: var(--label); }
.resident-art { width: 3.25rem; height: 4.5rem; display: block; }
.resident-art .px { width: 100%; height: 100%; }
.resident .name { margin-top: -0.125rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.625rem; font-weight: 600; color: #fff; background: rgba(0, 0, 0, 0.55); padding: 0 0.3125rem; border-radius: 0.25rem; }
.resident:active .resident-art { transform: translateY(-2px); }
.resident .rung { position: absolute; top: -0.25rem; right: 0.25rem; color: var(--energy); }
.town-pool { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.625rem; font-size: 0.875rem; }
.deposit-hero, .bell-hero { text-align: center; padding: 0.5rem 0 1rem; }
.deposit-hero .house { display: block; width: 9rem; margin: 0 auto; }
.deposit-hero .house .px { width: 100%; height: auto; }
.bell-hero { display: flex; align-items: center; gap: 1rem; text-align: left; }
.bell-own { margin-top: 1rem; display: grid; gap: 0.625rem; }
.avatar.has-buddy { background: color-mix(in srgb, var(--c) 22%, var(--surface)); overflow: hidden; }

/* Bakery boxes and sets, the box reveal, footprints */
.boxes, .sets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.625rem; }
.sets { grid-template-columns: repeat(3, 1fr); }
.box-card, .set-card { background: var(--surface); border-radius: var(--radius-card); padding: 0.75rem 0.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; color: var(--label); text-align: center; }
.box-card:active, .set-card:active { transform: scale(0.97); transition-duration: 0ms; }
.box-card[disabled], .set-card.owned { opacity: 0.55; }
.box-art { width: 4rem; height: 4rem; }
.box-art.small .box-body { fill: #6aa84f; } .box-art.small .box-lid { fill: #8fce6f; }
.box-art.large .box-body { fill: #d85a30; } .box-art.large .box-lid { fill: #f0997b; }
.box-card:hover .box-art, .box-card:focus-visible .box-art { animation: box-wiggle 600ms steps(1, end) 1; }
.box-name { font-weight: 600; font-size: 0.9375rem; }
.box-odds { font-size: 0.6875rem; color: var(--label-2); line-height: 1.3; display: inline-flex; align-items: center; gap: 0.25rem; }
.box-odds .icon { color: var(--green); }
.set-art { width: 4rem; height: 5.5rem; display: block; }
.set-art .px { width: 100%; height: 100%; }
.reveal { text-align: center; padding-top: 1.5rem; position: relative; }
.reveal-box { width: 7rem; margin: 0 auto; animation: box-shake 900ms steps(1, end) forwards, box-gone 200ms ease-out 1000ms forwards; }
.reveal-box .box-art { width: 7rem; height: 7rem; }
.reveal-box .box-lid { animation: lid-pop 200ms ease-out 900ms forwards; transform-origin: 8px 3px; }
.reveal-piece { width: 6rem; height: 6rem; margin: -7rem auto 0; opacity: 0; transform: scale(0.4); animation: piece-in 450ms cubic-bezier(0.34, 1.56, 0.64, 1) 1050ms forwards; }
.reveal-piece .px { width: 100%; height: 100%; }
.reveal-label { color: var(--label-2); margin-top: 1rem; opacity: 0; animation: fade-up 300ms ease-out 1300ms forwards; }
.reveal-name { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; opacity: 0; animation: fade-up 300ms ease-out 1400ms forwards; }
.reveal-on { margin-top: 1rem; opacity: 0; animation: fade-up 400ms ease-out 1600ms forwards; }
@keyframes box-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } 75% { transform: rotate(-3deg); } }
@keyframes box-shake { 0%, 100% { transform: none; } 15% { transform: translateX(-4px) rotate(-5deg); } 30% { transform: translateX(4px) rotate(5deg); } 45% { transform: translateX(-4px) rotate(-4deg); } 60% { transform: translateX(4px) rotate(4deg); } 75% { transform: translateY(-6px); } }
@keyframes lid-pop { to { transform: translateY(-6px) rotate(-18deg); } }
@keyframes box-gone { to { opacity: 0; } }
@keyframes piece-in { to { opacity: 1; transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.1875rem; margin: 0 calc(var(--gutter) * -1); }
.photo { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--fill-2); display: block; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo em { position: absolute; top: 0.25rem; left: 0.375rem; font-style: normal; font-size: 0.6875rem; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.sticker { position: absolute; right: 0.25rem; bottom: 0.125rem; width: 2.25rem; height: 3.1rem; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45)); pointer-events: none; }
.sticker .px { width: 100%; height: 100%; }
.sticker.big { width: 4.5rem; height: 6.2rem; right: 0.5rem; bottom: 0.25rem; }
.photo-pick { display: block; position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-card); background: var(--surface); overflow: hidden; cursor: pointer; }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; color: var(--tint); font-weight: 600; }
.photo-pick.has-photo .photo-pick-empty { display: none; }
.photo-pick.is-over { outline: 2px dashed var(--tint); outline-offset: -6px; }
.footprint-card { background: var(--surface); border-radius: var(--radius-card); overflow: hidden; margin-top: 0.75rem; }
.footprint-head { display: flex; align-items: center; gap: 0.625rem; padding: 0.75rem 1rem; }
.footprint-head .row-main { display: flex; flex-direction: column; }
.footprint-steps { font-family: var(--font-rounded); font-weight: 700; font-size: 1.125rem; text-align: right; line-height: 1; }
.footprint-steps small { display: block; font-size: 0.6875rem; font-weight: 600; color: var(--label-2); font-family: var(--font); }
.footprint-photo { position: relative; }
.footprint-photo img { width: 100%; display: block; }
.footprint-caption { padding: 0.75rem 1rem 0; font-size: 0.9375rem; line-height: 1.4; }
.footprint-actions { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; flex-wrap: wrap; }

/* While the app waits, the buddy eats: two frames swapped like a flip book. */
.eating { position: relative; display: block; width: 7.5rem; height: 10.3125rem; margin: 0 auto; }
.eating .frame { position: absolute; inset: 0; }
.eating .frame .px { width: 100%; height: 100%; }
.eating .frame.a { animation: chew 900ms steps(1, end) infinite; }
.eating .frame.b { animation: chew 900ms steps(1, end) infinite reverse; }
@keyframes chew { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.working-buddy { text-align: center; }
.working-title { font-size: 1.25rem; font-weight: 700; margin-top: 1rem; color: var(--label); }
.working-hint { font-size: 0.9375rem; color: var(--label-2); margin-top: 0.375rem; line-height: 1.4; }
.working-hint.is-offline { color: var(--red); }
.working-overlay { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 2rem; }
.working-overlay .working-buddy { animation: fade-in 200ms ease-out both; }
@keyframes fade-in { from { opacity: 0; } }

/* ------------------------------------------------------------------ barcode scanner */
.scanner { position: fixed; inset: 0; z-index: 70; background: #000; color: #fff; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* A dimmed frame with a clear window: the cut-out is one big box-shadow around the reticle. */
.scanner-reticle {
  position: absolute; left: 50%; top: 42%; width: min(78vw, 20rem); height: 9.5rem; transform: translate(-50%, -50%);
  border-radius: 1rem; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55); outline: 2px solid rgba(255, 255, 255, 0.9); outline-offset: -1px;
}
.scanner-top { position: absolute; top: calc(var(--safe-top) + 0.5rem); left: 0.75rem; right: 0.75rem; display: flex; }
.scanner-bottom { position: absolute; left: 1rem; right: 1rem; bottom: calc(var(--safe-bottom) + 1.5rem); display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; }
.scanner-bottom p { font-size: 1.0625rem; font-weight: 500; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.scanner-btn {
  display: inline-flex; align-items: center; gap: 0.375rem; min-height: 2.75rem; padding: 0 1rem; border-radius: 1.375rem;
  color: #fff; font-size: 1.0625rem; background: rgba(60, 60, 67, 0.6);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.scanner-btn:active { opacity: 0.6; }
html.scanning, html.scanning body { overflow: hidden; }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; top: calc(var(--safe-top) + 0.5rem); left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; pointer-events: none; padding: 0 1rem; }
.toast {
  max-width: 26rem; padding: 0.6875rem 1rem; border-radius: 1.375rem;
  background: var(--material); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16), 0 0 0 0.5px var(--separator);
  font-size: 0.9375rem; font-weight: 500; line-height: 1.3; text-align: center;
  animation: toast-in 420ms var(--ease-out) both; transition: opacity 240ms ease, transform 240ms ease;
}
.toast.leaving { opacity: 0; transform: translateY(-0.75rem); }
.toast.error { color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-1rem) scale(0.96); } }

/* ------------------------------------------------------------------ auth */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 2rem 1.5rem calc(var(--safe-bottom) + 2rem); max-width: 26rem; margin: 0 auto; }
.auth-mark { width: 5.5rem; height: 5.5rem; border-radius: 1.375rem; margin: 0 auto 1.5rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14); }
.auth h1 { font-size: 2.125rem; font-weight: 700; letter-spacing: -0.022em; text-align: center; }
.auth .lede { text-align: center; color: var(--label-2); margin: 0.375rem 0 2rem; }
.auth .btn { margin-top: 1.25rem; }
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 0.625rem; padding: 0.5rem 0 0.5rem; }
.profile-head h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.015em; }
.target-grid { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 0.5rem; }
.target-grid .metric { font-size: 1.375rem; }
.target-grid span { display: block; font-size: 0.75rem; color: var(--label-2); margin-top: 0.125rem; }

/* ------------------------------------------------------------------ page transitions */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; }
.tabbar { view-transition-name: tabbar; }

/* ------------------------------------------------------------------ accessibility */
:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; border-radius: 0.375rem; }
.field input:focus-visible, .search input:focus-visible { outline: none; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .ring-value, .bar > i, .toast { animation: none; }
  .spinner { animation-duration: 2.4s; }
  .mark-step, .mark-heart, .mark-heart rect { animation: none; transform: none; opacity: 1; }
  .splash-word { animation: none; opacity: 1; }
  .eating .frame { animation: none; } .eating .frame.b { opacity: 0; } .working-overlay .working-buddy { animation: none; }
  .reveal-box { display: none; } .reveal-piece, .reveal-label, .reveal-name, .reveal-on { animation: none; opacity: 1; transform: none; margin-top: 0; } .box-card:hover .box-art { animation: none; }
  .segmented .thumb, .btn, .icon-btn, .action { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .navbar::before, .tabbar, .toast { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --separator: var(--label-2); --label-2: var(--label); }
  .navbar::before, .tabbar, .toast { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .card, .group, .action { outline: 1px solid var(--label-2); }
}

/* Tablet width: still the phone layout, as one centred column. */
@media (min-width: 40rem) and (max-width: 59.99rem) {
  body { background: var(--bg); }
  .app { border-inline: 0.5px solid var(--separator); }
}

/* Parts that only exist on a desktop. */
.tabbar-brand, .tabbar-foot, .dropzone, .drop-hint { display: none; }

/* ------------------------------------------------------------------ desktop
   From 960 px the tab bar becomes a sidebar, dashboards split into two columns, wide grids
   spread out, and sheets open as centred dialogs. Phones never see any of this. */
@media (min-width: 60rem) {
  :root { --sidebar-w: 15rem; --gutter: 1.5rem; }
  .tabbar {
    top: 0; right: auto; width: var(--sidebar-w); padding: 1rem 0.75rem; border-top: 0; border-right: 0.5px solid var(--separator);
    display: flex; flex-direction: column; gap: 1rem; view-transition-name: none;
  }
  .tabbar-brand { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.5rem 0.75rem; color: var(--label); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.03em; }
  .tabbar-brand .mark { width: 2rem; height: 2rem; }
  .tabbar-brand .mark-step, .tabbar-brand .mark-heart rect { animation: none; transform: none; opacity: 1; }
  .tabbar-brand .mark-heart { animation: none; }
  .tabbar-brand b { color: var(--tint); font-weight: 800; }
  .tabbar-inner, .tabbar-foot { max-width: none; height: auto; margin: 0; display: flex; flex-direction: column; gap: 0.125rem; }
  .tabbar-foot { margin-top: auto; border-top: 0.5px solid var(--separator); padding-top: 0.75rem; }
  .tab { flex-direction: row; justify-content: flex-start; gap: 0.75rem; padding: 0.5rem 0.75rem; border-radius: 0.625rem; font-size: 0.9375rem; font-weight: 500; color: var(--label); min-height: 2.5rem; }
  .tab .icon { width: 1.375rem; height: 1.375rem; color: var(--label-2); }
  .tab:hover { background: var(--fill-2); }
  .tab[aria-current="page"] { background: color-mix(in srgb, var(--tint) 12%, transparent); color: var(--tint); }
  .tab[aria-current="page"] .icon { color: var(--tint); }

  body:has(.tabbar) .app, body:has(.tabbar) .toasts { margin-left: var(--sidebar-w); }
  .app { max-width: 46rem; }
  body:has(.screen.wide) .app { max-width: 76rem; }
  .screen { padding: 0 var(--gutter) 3rem; }
  .screen.no-tabbar { padding-bottom: 3rem; }
  .large-title { font-size: 2.5rem; }

  .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 2rem; align-items: start; }
  .col > :first-child, .col > .card:first-child { margin-top: 0; }
  .col > .section-title:first-child { margin-top: 0.25rem; }
  .town-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(26rem, 1fr)); gap: 1rem; align-items: start; }
  .town-grid .town-card + .town-card { margin-top: 0; }
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); }
  .boxes { grid-template-columns: repeat(2, minmax(0, 16rem)); }
  .sets { grid-template-columns: repeat(3, minmax(0, 12rem)); }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.375rem; margin: 0; }
  .photo { border-radius: 0.5rem; }
  .stage.big { height: 18rem; }

  /* Sheets become dialogs in the middle of the screen; the spring still lifts them in. */
  .sheet { inset: 0; margin: auto; height: fit-content; width: min(34rem, calc(100vw - 4rem)); max-height: min(44rem, calc(100dvh - 4rem)); border-radius: 1rem; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28); }
  .sheet::after { display: none; }
  .sheet-grabber { display: none; }
  .sheet-handle { cursor: default; }
  .sheet-body { padding-bottom: 1.25rem; }
  html.sheet-open, html.sheet-open body { background: var(--bg); }
  html.sheet-open .app { border-radius: 0; overflow: visible; }

  .dropzone { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.125rem; margin-bottom: 0.75rem; border: 1.5px dashed var(--label-3); border-radius: var(--radius-card); color: var(--label-2); cursor: pointer; font-size: 0.9375rem; line-height: 1.35; }
  .dropzone b { color: var(--label); }
  .dropzone .icon { color: var(--tint); flex: none; }
  .dropzone:hover { border-color: var(--tint); background: color-mix(in srgb, var(--tint) 6%, transparent); }
  .drop-hint { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; color: var(--label-2); margin: 0.75rem 1rem 0; }
}

/* A mouse or trackpad: things that can be clicked say so. */
@media (hover: hover) and (pointer: fine) {
  a.row:hover, button.row:hover, label.row:hover { background: var(--fill-2); }
  a.card:hover { box-shadow: 0 0 0 1px var(--separator), 0 6px 18px rgba(0, 0, 0, 0.06); }
  .action:hover, .pc:hover, .box-card:hover, .set-card:hover, .chip:hover { filter: brightness(0.97); }
  .btn:hover { filter: brightness(1.05); }
  .resident:hover .resident-art { transform: translateY(-2px); }
  .photo:hover img { filter: brightness(1.05); }
}

/* Dragging a photo over a page that takes one. */
.drop-overlay { position: fixed; inset: 0; z-index: 85; display: flex; align-items: center; justify-content: center; padding: 2rem; background: color-mix(in srgb, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); pointer-events: none; }
.drop-overlay-box { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; padding: 2.5rem 3rem; border: 2px dashed var(--tint); border-radius: 1.5rem; background: var(--surface); color: var(--tint); font-size: 1.125rem; font-weight: 600; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18); }
.drop-overlay-box .icon { width: 2.5rem; height: 2.5rem; }
.drop-overlay.is-error .drop-overlay-box { border-color: var(--red); color: var(--red); }

/* ------------------------------------------------------------------ getting-started guide */
.guide { max-width: 34rem; margin: 0 auto; padding: calc(var(--safe-top, 0px) + 2.5rem) 1rem calc(var(--safe-bottom, 0px) + 3rem); }
.guide-head { text-align: center; margin-bottom: 1.5rem; }
.guide-head .auth-mark { width: 4.5rem; height: 4.5rem; border-radius: 1.125rem; margin-bottom: 1rem; }
.guide-head h1 { font-size: 2.125rem; font-weight: 700; letter-spacing: -0.022em; line-height: 1.1; }
.guide-head .lede { color: var(--label-2); margin-top: 0.5rem; line-height: 1.4; }
.guide-os { position: absolute; opacity: 0; pointer-events: none; }
.guide-switch { display: grid; grid-template-columns: 1fr 1fr; background: linear-gradient(var(--fill-2), var(--fill-2)), var(--bg); border-radius: 0.5625rem; padding: 0.125rem; position: sticky; top: calc(var(--safe-top, 0px) + 0.5rem); z-index: 5; margin-bottom: 1.25rem; box-shadow: 0 0 0 0.5rem var(--bg); }
.guide-switch label { height: 2.25rem; display: grid; place-items: center; font-size: 0.9375rem; font-weight: 500; border-radius: 0.4375rem; cursor: pointer; }
#os-ios:checked ~ .guide-switch label[for="os-ios"], #os-android:checked ~ .guide-switch label[for="os-android"] { background: var(--surface, #fff); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04); }
#os-ios:focus-visible ~ .guide-switch label[for="os-ios"], #os-android:focus-visible ~ .guide-switch label[for="os-android"] { outline: 2px solid var(--tint); }
#os-ios:checked ~ .only-android, #os-android:checked ~ .only-ios { display: none; }
.guide-step { background: var(--surface, #fff); border-radius: 1rem; padding: 1.25rem 1.125rem 1rem; margin-bottom: 1rem; }
.guide-num { font-size: 0.8125rem; font-weight: 600; color: var(--tint); text-transform: uppercase; letter-spacing: 0.02em; }
.guide-step h2 { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.012em; margin: 0.125rem 0 0.875rem; }
.guide-step p { line-height: 1.45; }
.guide-step .steps { font-size: 1.0625rem; }
.guide-note { font-size: 0.9375rem; color: var(--label-2); margin: 0 0 0.875rem; }
.guide-step figure { margin: 0.25rem 0 1.125rem; }
.guide-step figure img { display: block; width: 100%; height: auto; border-radius: 0.75rem; border: 0.5px solid var(--separator, rgba(60, 60, 67, 0.29)); }
.guide-step figure.art img { max-width: 20rem; margin: 0 auto; border: 0; }
.guide-faq { margin: 0.75rem 0 0; padding-left: 1.125rem; line-height: 1.45; }
.guide-faq li { margin-bottom: 0.5rem; }

/* "Add your own size" in the food sheet */
.add-size { margin-top: 1rem; }
.add-size summary { list-style: none; cursor: pointer; color: var(--tint); font-size: 0.9375rem; padding: 0.25rem 1rem; }
.add-size summary::-webkit-details-marker { display: none; }

/* ------------------------------------------------------------------ macro chart review */
.chart-shot { width: 100%; max-height: 18rem; object-fit: contain; border-radius: 1rem; margin-top: 0.5rem; background: var(--fill-2); }
.chart-row-head { display: flex; align-items: center; gap: 0.5rem; }
.chart-name { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--label); padding: 0.25rem 0; outline: none; }
.chart-row:has(input[type="checkbox"]:not(:checked)) :is(.chart-name, .macro-grid) { opacity: 0.4; }
.macro-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-top: 0.625rem; }
.macro-grid label { display: grid; gap: 0.25rem; font-size: 0.75rem; color: var(--label-2); }
.macro-grid input { width: 100%; height: 2.5rem; border: 0; border-radius: 0.625rem; background: var(--fill-2); text-align: center; font-weight: 600; color: var(--label); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ luxury shelf and try-on */
.lux-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.625rem; }
.lux-card {
  display: grid; justify-items: center; gap: 0.375rem; padding: 0.875rem 0.625rem 0.75rem; border-radius: var(--radius-card);
  background: linear-gradient(160deg, color-mix(in srgb, #e8c15a 16%, var(--surface)), var(--surface) 60%);
  border: 0.5px solid color-mix(in srgb, #b8902c 35%, transparent); color: var(--label); text-align: center;
}
.lux-card.owned { opacity: 0.6; }
.lux-art { width: 4.5rem; height: 4.5rem; display: flex; }
.lux-art .px { width: 100%; height: 100%; }
.lux-name { font-weight: 600; font-size: 0.875rem; line-height: 1.2; }
.lux-tag { display: inline-block; margin-right: 0.375rem; padding: 0.0625rem 0.4375rem; border-radius: 999px; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; vertical-align: 0.15em; color: #6b4e0e; background: linear-gradient(135deg, #f6dc8c, #d9ad3c); }
.try-compare { display: grid; grid-template-columns: 1fr 1.35fr; gap: 0.625rem; align-items: end; }
.try-compare figure { margin: 0; display: grid; gap: 0.375rem; text-align: center; }
.try-compare figcaption { font-size: 0.75rem; color: var(--label-2); }
.try-compare .try-stage { height: 9rem; background: var(--surface); }
.try-compare .with .try-stage { height: 12.5rem; box-shadow: 0 0 0 2px var(--tint) inset; }
.try-name { text-align: center; font-size: 1.125rem; margin: 0.875rem 0 0.25rem; }
.try-dots { display: flex; justify-content: center; margin-top: 0.5rem; }
@media (min-width: 60rem) { .lux-grid { grid-template-columns: repeat(4, 1fr); } }

/* ------------------------------------------------------------------ town scene */
.preview-banner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 0.75rem; align-items: center; margin: 0.5rem 0 0.75rem; padding: 0.625rem 0.875rem; border-radius: var(--radius-control); background: color-mix(in srgb, var(--tint) 12%, var(--surface)); font-size: 0.9375rem; }
.preview-banner a { font-weight: 600; }
.scene-wrap { position: relative; width: 100%; overflow: auto; border-radius: var(--radius-card); margin-top: 0.5rem; overscroll-behavior: contain; scrollbar-width: none; touch-action: pan-x pan-y pinch-zoom; box-shadow: 0 0 0 0.5px var(--separator); }
.scene-wrap::-webkit-scrollbar { display: none; }
.scene { --zoom: 1; position: relative; width: calc(100% * var(--zoom)); height: calc(100% * var(--zoom)); overflow: hidden; background: linear-gradient(#8fd3ff, #dff3ff 70%); }
.scene .px { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.scene.sky-dusk { background: linear-gradient(#6d6fc7, #ff9a76 55%, #ffd59e); }
.scene.sky-night { background: radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent), radial-gradient(1px 1px at 34% 9%, #fff 50%, transparent), radial-gradient(1.5px 1.5px at 58% 22%, #fff 50%, transparent), radial-gradient(1px 1px at 76% 12%, #fff 50%, transparent), radial-gradient(1px 1px at 90% 30%, #fff 50%, transparent), radial-gradient(1px 1px at 22% 34%, #fff 50%, transparent), linear-gradient(#0f1a3c, #2d3c6e 70%); }
.sky-body { position: absolute; top: 7%; right: 9%; width: 7%; aspect-ratio: 1; border-radius: 50%; background: #ffe066; box-shadow: 0 0 0 0.35rem rgba(255, 224, 102, 0.25); }
.sky-dusk .sky-body { top: 30%; background: #ffb347; }
.sky-night .sky-body { background: #f4f1de; box-shadow: inset -0.5rem 0 0 #d9d3b5; }
.cloud { position: absolute; width: 12%; opacity: 0.95; animation: cloud-drift 70s linear infinite; }
.cloud.c1 { top: 8%; animation-delay: -20s; }
.cloud.c2 { top: 20%; width: 9%; animation-duration: 95s; animation-delay: -70s; }
.sky-night .cloud { opacity: 0.25; }
@keyframes cloud-drift { from { left: -15%; } to { left: 105%; } }
.land { position: absolute; left: 0; right: 0; bottom: 0; height: var(--ground); background: linear-gradient(#7cc36b, #6fb45f); box-shadow: 0 -2px 0 #5d9e4f; }
.horizon { display: none; position: absolute; left: 0; right: 0; bottom: var(--ground); height: 14%; background: linear-gradient(#5fc0ec, #3aa8e0); }
.setting-street .land { background: linear-gradient(#c9ced6 0 9%, #7cc36b 9%, #6fb45f); }
.setting-garden .land { background: linear-gradient(#5fae4f, #4f9a42); }
.setting-coast .land { background: linear-gradient(#7cc36b 0 45%, #f1dcac 45%); }
.setting-beach .horizon, .setting-sea .horizon { display: block; }
.setting-beach .land { background: linear-gradient(#f6e6bd, #ead09a); box-shadow: 0 -2px 0 #fff6dc; }
.setting-sea .horizon { height: 26%; background: linear-gradient(#5fc0ec, #1f8fd0); }
.setting-sea .land { background: repeating-linear-gradient(90deg, #b9814f 0 7.6%, #8a5a3c 7.6% 8.3%), #b9814f; box-shadow: 0 -3px 0 #8a5a3c, 0 -5px 0 #1b1b1b33; }  /* the deck you stand on */
.sky-night .land, .sky-night .horizon, .sky-night .prop, .sky-night .scene-house { filter: brightness(0.62) saturate(0.85); }
.sky-dusk .land, .sky-dusk .scene-house, .sky-dusk .prop { filter: brightness(0.9) sepia(0.12); }
.prop, .scene-house { position: absolute; display: block; }
.scene-house { z-index: 2; }
.prop { z-index: 1; }
.prop.front { z-index: 110; }

.walker { position: absolute; display: block; padding: 0; margin: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.walker-move, .walker-flip, .walker-body { display: block; }
.walker-name { position: absolute; left: 50%; bottom: -0.9em; transform: translateX(-50%); font-size: clamp(0.5rem, 1.5vw, 0.6875rem); font-weight: 600; color: #fff; background: rgba(0, 0, 0, 0.55); padding: 0 0.3125rem; border-radius: 0.25rem; white-space: nowrap; }
.walker .rung { position: absolute; top: -4%; right: -6%; color: var(--energy); }
.pose-walking .walker-move { animation: walk-x var(--t) linear var(--delay) infinite alternate; }
.pose-walking .walker-flip { animation: walk-face calc(var(--t) * 2) steps(1) var(--delay) infinite; }
.pose-walking .walker-body { animation: walk-bob 0.5s steps(2) infinite; }
@keyframes walk-x { from { transform: translateX(calc(var(--walk) * -0.5)); } to { transform: translateX(calc(var(--walk) * 0.5)); } }
@keyframes walk-face { 0% { transform: scaleX(1); } 50% { transform: scaleX(-1); } }
@keyframes walk-bob { from { transform: translateY(0); } to { transform: translateY(-4%); } }
.pose-cheering .walker-body { animation: cheer-hop var(--t) cubic-bezier(0.3, 0, 0.4, 1) var(--delay) infinite alternate; }
@keyframes cheer-hop { from { transform: translateY(0); } to { transform: translateY(-16%); } }
.cheer { position: absolute; top: -8%; left: 50%; color: #ffcf33; font-size: clamp(0.6rem, 1.8vw, 0.9rem); text-shadow: 0 0 2px rgba(0, 0, 0, 0.35); animation: cheer-twinkle 1.2s ease-in-out infinite; }
@keyframes cheer-twinkle { 0%, 100% { opacity: 0.3; transform: translateX(-50%) scale(0.8); } 50% { opacity: 1; transform: translateX(-50%) scale(1.15); } }
.walker-body:has(.sit-art) { position: relative; }
.sit-art, .sit-top, .sit-legs { display: block; position: relative; }
.sit-bench { position: absolute; left: 12.5%; right: 12.5%; bottom: 0; }  /* 24 of the buddy's 32 pixels */
.sit-bench .px { height: auto; }
.pose-sitting .sit-art { animation: breathe 3.2s ease-in-out infinite; transform-origin: bottom center; }
@keyframes breathe { 50% { transform: scaleY(1.025); } }
.pose-sleeping .walker-body { transform: translateY(13.6%) rotate(-90deg); }  /* lying on the ground, head to the left */
.pose-sleeping .walker-body .px { animation: breathe 4s ease-in-out infinite; }
.zzz { position: absolute; top: 38%; left: -26%; width: 26%; animation: zzz-float 2.6s ease-in infinite; }
@keyframes zzz-float { 0% { opacity: 0; transform: translate(0, 30%) scale(0.7); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(40%, -70%) scale(1.1); } }
.zoom-bar { display: flex; justify-content: center; align-items: center; gap: 0.75rem; margin-top: 0.625rem; }
.zoom-btn { width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--surface); font-size: 1.25rem; font-weight: 600; color: var(--tint); box-shadow: 0 0 0 0.5px var(--separator); }
.zoom-label { min-width: 2.5rem; text-align: center; color: var(--label-2); font-size: 0.875rem; }
.pose-chip { flex: none; font-size: 0.75rem; font-weight: 600; padding: 0.125rem 0.5rem; border-radius: 999px; background: var(--fill-2); color: var(--label-2); }
.pose-chip.walking { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.pose-chip.cheering { background: color-mix(in srgb, #e8a700 20%, transparent); color: #b07d00; }
.pose-chip.sleeping { background: color-mix(in srgb, var(--indigo, #5856d6) 16%, transparent); color: var(--indigo, #5856d6); }
.levels-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 8.5rem; gap: 0.625rem; overflow-x: auto; padding: 0.125rem 0.125rem 0.5rem; scrollbar-width: none; scroll-snap-type: x proximity; }
.levels-strip::-webkit-scrollbar { display: none; }
.level-card { display: grid; justify-items: center; align-content: end; gap: 0.25rem; padding: 0.75rem 0.5rem 0.625rem; border-radius: var(--radius-card); background: var(--surface); color: var(--label); scroll-snap-align: start; min-height: 9.5rem; }
.level-card.current { box-shadow: 0 0 0 2px var(--tint) inset; }
.level-card.shown { background: color-mix(in srgb, var(--tint) 10%, var(--surface)); }
.level-card.locked .level-art { filter: grayscale(0.55) opacity(0.75); }
.level-art { width: 100%; height: 4.75rem; display: flex; align-items: flex-end; justify-content: center; }
.level-art .px { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.level-name { font-weight: 600; font-size: 0.875rem; }
.level-sub { display: inline-flex; align-items: center; gap: 0.1875rem; font-size: 0.75rem; color: var(--label-2); }
.level-sub .pandesal { width: 0.875rem; height: 0.875rem; }
.ground[data-href] { cursor: zoom-in; }
.town-open { position: absolute; top: 0.25rem; right: calc(var(--gutter) + 0.25rem); z-index: 3; display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; font-weight: 600; color: var(--label); background: color-mix(in srgb, var(--surface) 82%, transparent); padding: 0.1875rem 0.5rem; border-radius: 999px; backdrop-filter: blur(8px); }
@media (min-width: 60rem) { .levels-strip { grid-auto-columns: 10rem; } }
@media (prefers-reduced-motion: reduce) {
  .cloud, .walker-move, .walker-flip, .walker-body, .sit-art, .zzz, .cheer, .pose-sleeping .walker-body .px { animation: none !important; }
}
.btn:disabled { opacity: 0.4; pointer-events: none; }
