/* Layout: one phone-width column, slim top bar, fixed bottom tab bar; cards only for the things you act on.
   Single black and electric-blue look (LED strips on black), the same in light and dark mode. */

/* Base reset (the Claude artifact wrapper used to provide this) */
html { -webkit-text-size-adjust: 100%; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; min-height: 100vh; }
img { max-width: 100%; }
[hidden] { display: none !important; }

:root {
  --bg: #04050B;
  --surface: #0A0D1C;
  --surface-2: #121834;
  --ink: #E9EDFF;
  --muted: #8C95C2;
  --line: #1D2550;
  --accent: #3D5CFF;      /* electric blue: gym, buttons */
  --accent-text: #8EA2FF; /* the same blue, light enough for small text on black */
  --accent-ink: #FFFFFF;
  --run: #C9D4FF;         /* cardio: pale lightning white-blue */
  --good: #4FD8FF;        /* ice blue: done, on target */
  --danger: #FF5C7A;
  --danger-ink: #1A0309;  /* text on danger-coloured buttons */
  /* Glows and shadows are tokens so the Light scheme can turn them down */
  --glow-hi: color-mix(in srgb, var(--accent) 75%, transparent);
  --glow-md: color-mix(in srgb, var(--accent) 42%, transparent);
  --glow-lo: color-mix(in srgb, var(--accent) 30%, transparent);
  --bg-tint: color-mix(in srgb, var(--accent) 16%, var(--bg));
  --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r: 12px;
  color-scheme: dark;
}

/* Colour schemes (Account › Appearance). Electric Blue is the :root default above; each block redefines every colour
   token. Contrast checked to WCAG AA (see README). Applied as <html data-scheme="…">. */
:root[data-scheme="neon"] {
  --bg: #040605; --surface: #0B120E; --surface-2: #15201A; --ink: #E8F5EC; --muted: #8EA898; --line: #213028; --accent: #2FE071; --accent-text: #5FEA92; --accent-ink: #03140A; --run: #D6F4FF; --good: #F2D64B; --danger: #FF6B5E; --danger-ink: #1A0503;
}
:root[data-scheme="crimson"] {
  --bg: #070304; --surface: #140A0C; --surface-2: #211114; --ink: #F7EBED; --muted: #B5979C; --line: #3A1C21; --accent: #E5233F; --accent-text: #FF8394; --accent-ink: #FFFFFF; --run: #FFD6DC; --good: #4FD8A0; --danger: #FFB020; --danger-ink: #1F1300;
}
:root[data-scheme="sunset"] {
  --bg: #0E0B09; --surface: #1A1512; --surface-2: #27201B; --ink: #F6EDE6; --muted: #B59F91; --line: #3D3029; --accent: #FF7A1A; --accent-text: #FFA562; --accent-ink: #1A0D03; --run: #FFE0A3; --good: #6FD3A8; --danger: #FF4D6A; --danger-ink: #1F0309;
}
:root[data-scheme="violet"] {
  --bg: #07040D; --surface: #110B1D; --surface-2: #1C1331; --ink: #F0EAFF; --muted: #A598C9; --line: #2D2049; --accent: #7C4DF0; --accent-text: #B79CFF; --accent-ink: #FFFFFF; --run: #E4D9FF; --good: #4FD8C0; --danger: #FF5C7A; --danger-ink: #1A0309;
}
:root[data-scheme="light"] {
  --bg: #F3F5F9; --surface: #FFFFFF; --surface-2: #E8ECF3; --ink: #111827; --muted: #556072; --line: #D2D8E2; --accent: #2F55E0; --accent-text: #2448C8; --accent-ink: #FFFFFF; --run: #7A3FD6; --good: #0B7F57; --danger: #C42340; --danger-ink: #FFFFFF;
  --glow-hi: transparent; --glow-md: color-mix(in srgb, var(--accent) 18%, transparent); --glow-lo: transparent;
  --bg-tint: color-mix(in srgb, var(--accent) 5%, var(--bg)); --shadow: 0 6px 20px rgba(17, 24, 39, .18);
  color-scheme: light;
}
* { box-sizing: border-box; }
body { background: radial-gradient(120% 60% at 50% 0%, var(--bg-tint), var(--bg) 70%) fixed, var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, input[inputmode], .tab { font-variant-numeric: tabular-nums; }

.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg);
  border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 640px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 10px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: .06em; text-transform: uppercase; }
/* Account button (header, top right): avatar + sync status dot */
.acct { appearance: none; position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 1.5px solid var(--accent); background: var(--surface-2); color: var(--ink); display: grid; place-items: center;
  box-shadow: 0 0 12px var(--glow-lo); }
.acct:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.acct-face { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; display: grid; place-items: center; }
.acct-face svg { width: 24px; height: 24px; color: var(--muted); }
.acct-face img, .acct-big img { width: 100%; height: 100%; object-fit: cover; display: block; }
.initial { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; line-height: 1; }
.acct-dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--bg); background: var(--muted); }
.acct-dot[data-s="db"] { background: var(--good); }
.acct-dot[data-s="local"] { background: var(--danger); }
.acct-dot[data-s="offline"] { background: var(--run); }
.acct-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.acct-big { flex: none; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--surface-2); border: 1.5px solid var(--accent); }
.acct-big svg { width: 34px; height: 34px; color: var(--muted); }
.acct-big .initial { font-size: 1.8rem; }
.brand { color: var(--ink); font-style: italic; text-shadow: 0 0 14px var(--glow-md); }
.brand-wrap { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
/* Progress: jump chips and the sections they scroll to (clear of the sticky header). */
.jump { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 64px); z-index: 4; background: var(--bg); padding-block: 6px; margin-block: -6px; }
.jump-sec { display: flex; flex-direction: column; gap: inherit; scroll-margin-top: 124px; }
/* The logo and title are a home button: no button chrome, so the header looks the same. */
button.brand-wrap { background: none; border: 0; padding: 0; margin: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 10px; -webkit-tap-highlight-color: transparent; }
button.brand-wrap:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.app-ver { text-align: center; margin: 4px 0 0; }
.mark { width: 36px; height: 36px; flex: none; }   /* transparent gorilla head; per-scheme help below if needed */
/* Sign-in brand block */
.hero { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding-block: 8px 4px; }
.hero-lockup { width: min(280px, 78vw); height: auto; }
.tagline { margin: 0; font-size: .78rem; font-weight: 600; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); }
.btn.primary { box-shadow: 0 0 18px var(--glow-md); }
.topbar { border-bottom-color: var(--accent); box-shadow: 0 1px 16px var(--glow-md); }
nav.tabs { border-top-color: var(--accent) !important; box-shadow: 0 -1px 16px var(--glow-lo); }

main { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 18px calc(190px + env(safe-area-inset-bottom, 0px)); }   /* clears the tab bar and the rest-timer bar */

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; text-wrap: balance; line-height: 1.1; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
.eyebrow { font-size: .74rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
p { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.empty { border: 1.5px dashed var(--line); border-radius: var(--r); padding: 18px; color: var(--muted); }
.banner { border-radius: var(--r); padding: 12px 14px; background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line)); font-size: .9rem; }

.btn { appearance: none; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; min-height: 44px; padding: 0 16px;
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.run { background: var(--run); border-color: var(--run); color: var(--bg); }   /* dark text on the pale cardio colour (AA contrast) */
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .88rem; }
/* Plan library */
.lib-card { text-align: left; cursor: pointer; font: inherit; color: inherit; width: 100%; gap: 6px; }
.lib-card:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.lib-meta { color: var(--muted); font-size: .85rem; }
.filt { display: flex; flex-direction: column; gap: 6px; }
.facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0; font-size: .92rem; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0 0 10px; }
.facts dd:last-child { margin-bottom: 0; }
.lib-day { display: flex; flex-direction: column; gap: 6px; padding-block: 10px; border-top: 1px solid var(--line); }
.lib-day:first-of-type { border-top: 0; padding-top: 0; }
.lib-ex { display: flex; align-items: center; gap: 8px; justify-content: space-between; min-height: 32px; }
.lib-ex .nm { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
/* Exercise guide sheet */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(2, 3, 8, .6); display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-in { width: 100%; max-width: 560px; margin: 0 auto; max-height: 82vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 16px 16px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; }
.sheet-in ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.btn.rep-btn { min-height: 44px; flex: none; display: inline-flex; align-items: center; pointer-events: none; }   /* looks like a button; the whole row is the tap target */
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger-text { color: var(--danger); }
.btn.armed { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }
.btn:focus-visible, .chip:focus-visible, .tab:focus-visible, .tick:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-text); outline-offset: 2px; }
.btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.chip { appearance: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; min-height: 36px; padding: 0 14px; cursor: pointer; font-weight: 500; font-size: .9rem; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill.over { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.pill.gym { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-text); }
.pill.run { background: color-mix(in srgb, var(--run) 15%, transparent); color: var(--run); }
.pill.on { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }

label.field { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; font-weight: 600; color: var(--muted); min-width: 0; }
input.in, select.in, textarea.in { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); padding: 0 12px; font-size: 1rem; font-weight: 500; color: var(--ink); }
textarea.in { padding: 10px 12px; min-height: 76px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* Week strip */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; border-radius: 10px; background: var(--surface-2); }
.day.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.day .d1 { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.day .d2 { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.marks { display: flex; gap: 3px; height: 8px; }
.mk { width: 8px; height: 8px; border-radius: 50%; }
.mk.gym { background: var(--accent); }
.mk.run { background: var(--run); }
.goal { display: flex; align-items: baseline; gap: 8px; }
.goal .big { font-family: var(--font-display); font-weight: 700; font-size: 2.6rem; line-height: 1; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--good); border-radius: 4px; }

/* Session list */
.list { display: flex; flex-direction: column; }
.item { appearance: none; text-align: left; width: 100%; background: none; border: 0; border-top: 1px solid var(--line); padding: 12px 0; cursor: pointer; display: grid; grid-template-columns: 4.2rem 1fr auto; gap: 10px; align-items: center; }
.item:first-child { border-top: 0; }
.item .when { font-size: .78rem; color: var(--muted); line-height: 1.2; }
.item .when b { display: block; font-family: var(--font-display); font-size: 1.25rem; color: var(--ink); }
.item .what { min-width: 0; }
.item .what strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.item .what span { font-size: .85rem; color: var(--muted); }
.detail { padding: 4px 0 14px; display: flex; flex-direction: column; gap: 10px; border-top: 1px dashed var(--line); }
.detail .exl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: .92rem; }
.detail .exl span:nth-child(even) { color: var(--muted); text-align: right; }
.month-h { margin-top: 6px; }

/* Logger */
.ex { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ex-head { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.ex-head input { font-weight: 600; font-size: 1.05rem; }
.ex-meta { font-size: .82rem; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.ex-meta b { color: var(--ink); font-weight: 600; }
.sets { display: flex; flex-direction: column; gap: 6px; }
.set { display: grid; grid-template-columns: 2rem 1fr 1fr 44px; gap: 8px; align-items: center; }
.set.hd { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.set.hd span { text-align: center; }
.set .n { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; text-align: center; color: var(--muted); }
.set input { text-align: center; font-size: 1.1rem; font-weight: 600; }
.set.done input { border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.tick { appearance: none; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; color: transparent; }
.tick svg { width: 20px; height: 20px; }
.set.done .tick { background: var(--good); border-color: var(--good); color: var(--accent-ink); }
.rpe { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
@media (max-width: 440px) { .rpe { grid-template-columns: repeat(5, 1fr); gap: 6px; } }   /* 2 rows of 5 on phones: buttons stay ≥ 44 px wide */
/* iOS Safari gives date inputs their own height and minimum width; make them behave like the other fields */
input.in[type="date"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; width: 100%; height: 44px; min-height: 44px; line-height: 42px; padding-block: 0; text-align: left; }
input.in[type="date"]::-webkit-date-and-time-value { text-align: left; }
.grid-2 > *, .grid-3 > * { min-width: 0; }
.rpe .chip { padding: 0; min-height: 40px; border-radius: 8px; font-weight: 600; }
.pace-out { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; }

/* Plans */
.plan-day { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.plan-day:first-of-type { border-top: 0; }
.plan-day .sum { font-size: .85rem; color: var(--muted); }
.pd-edit { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.it { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px dashed var(--line); }
.it-nums { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.stepper { display: inline-grid; grid-template-columns: 44px 3rem 44px; align-items: center; text-align: center; }
.stepper b { font-family: var(--font-display); font-size: 1.5rem; }

/* Stats */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; min-width: 0; }
.tile b { display: block; font-family: var(--font-display); font-size: 1.7rem; line-height: 1.1; }
.tile span { font-size: .78rem; color: var(--muted); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font-body); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .lbl { fill: var(--ink); font-weight: 600; font-size: 11px; }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.prs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pr { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.pr b { display: block; font-family: var(--font-display); font-size: 1.35rem; }
.pr span { font-size: .78rem; color: var(--muted); }

/* Body */
.food { display: grid; grid-template-columns: minmax(0, 1fr) auto 36px; gap: 8px; align-items: center; padding: 4px 0; border-top: 1px solid var(--line); }
.food:first-child { border-top: 0; }
.food span:first-child { overflow-wrap: anywhere; }
.food-add { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem auto; gap: 8px; align-items: center; }
.proj { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.proj .pr b { font-size: 1.25rem; }
.mini { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini > div { min-width: 0; }
.mini b { display: block; font-family: var(--font-display); font-size: 1.4rem; }
.mini span { font-size: .78rem; color: var(--muted); }

/* Sign-in */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg .chip { min-height: 44px; }
.pw-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.pw-row .btn { min-width: 64px; }
.si-msg { margin: 0; font-size: .88rem; padding: 8px 10px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.si-msg.ok { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); background: color-mix(in srgb, var(--good) 10%, var(--surface)); }

/* Welcome flow */
.ob-steps { display: flex; gap: 6px; }
.ob-steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-2); }
.ob-steps i.on { background: var(--accent); }
.ob-nav { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.ob-nav .btn { min-height: 48px; }

/* Food logging */
.food small { display: block; font-size: .78rem; }
.food-name { appearance: none; background: none; border: 0; padding: 4px 0; color: inherit; font: inherit; text-align: left; cursor: pointer; min-width: 0; overflow-wrap: anywhere; }
.food-name:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 4px; }
.meal-h { padding-top: 6px; }
.meal-pick { padding: 4px 0 8px; gap: 6px; }
/* Food search */
.fq-list { padding-block: 2px; gap: 0; }
.fq-row { appearance: none; background: none; border: 0; border-top: 1px solid var(--line); width: 100%; text-align: left; padding: 10px 0; min-height: 44px; cursor: pointer; color: inherit; font: inherit; display: flex; flex-direction: column; gap: 2px; }
.fq-row:first-child { border-top: 0; }
.fq-row:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 6px; }
.fq-row small { color: var(--muted); font-size: .8rem; }
.toast .btn { margin-left: 10px; min-height: 32px; background: var(--surface); color: var(--ink); }
.macro-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(68px, 1fr)); gap: 8px; }
.mbars { display: flex; flex-direction: column; gap: 10px; }
.mbar { display: flex; flex-direction: column; gap: 4px; }
.mbar .row { flex-wrap: nowrap; }
.mt-edit { border-top: 1px dashed var(--line); padding-top: 12px; }
.macro-row > div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.macro-row b { display: block; font-family: var(--font-display); font-size: 1.2rem; }
.macro-row span { font-size: .75rem; color: var(--muted); }
.food-panel { border: 1px solid var(--accent); border-radius: var(--r); padding: 14px; background: var(--bg);
  box-shadow: 0 0 14px var(--glow-lo); }
.qty-in { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; min-height: 54px; text-align: center; }
.adj { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.adj .btn { min-height: 44px; min-width: 44px; padding: 0 6px; font-variant-numeric: tabular-nums; }
.note { margin: 0; font-size: .85rem; line-height: 1.4; padding: 8px 10px; border-radius: 8px;
  background: color-mix(in srgb, var(--good) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--good) 35%, var(--line)); }
.info { appearance: none; flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--accent-text); font: italic 700 .85rem/1 Georgia, serif; cursor: pointer; position: relative; }
.info::after { content: ""; position: absolute; inset: -8px; }   /* 44px tap target around the 28px circle */
.info:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.fe-calc { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.star { appearance: none; flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.star[aria-pressed="true"] { color: var(--good); border-color: var(--good); }
.star:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* Barcode scanner overlay */
.scan { position: fixed; inset: 0; z-index: 30; background: rgba(2, 3, 8, .94); overflow-y: auto;
  padding-top: max(16px, env(safe-area-inset-top, 0px)); padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.scan-in { max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.scan-view { position: relative; width: 100%; max-width: 100%; aspect-ratio: 4 / 3; border-radius: var(--r); overflow: hidden;
  background: #000; border: 1px solid var(--accent); }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-aim { position: absolute; left: 12%; right: 12%; top: 35%; bottom: 35%; border: 2px solid var(--good); border-radius: 10px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }

/* Bottom nav, rest timer, toast */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
.tabs-in { max-width: 640px; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.tab { appearance: none; background: none; border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 9px; color: var(--muted); font-size: .72rem; font-weight: 600; letter-spacing: .04em; position: relative; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--accent-text); }
.tab[aria-current="page"]::after { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.tab .dot { position: absolute; top: 6px; right: calc(50% - 16px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.rest { position: fixed; z-index: 9; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 8px; pointer-events: none; }
.rest-in { pointer-events: auto; max-width: 608px; margin: 0 auto; background: var(--surface-2); color: var(--ink); border: 1px solid var(--accent); border-radius: 14px; padding: 10px 12px 10px 16px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); }
.rest-in .t { font-family: var(--font-display); font-weight: 700; font-size: 1.8rem; min-width: 4.2rem; }
.rest-in .lab { flex: 1; font-size: .85rem; opacity: .8; }
.rest-in button { appearance: none; border: 1px solid currentColor; background: transparent; color: inherit; border-radius: 8px; min-height: 36px; padding: 0 10px; font-weight: 600; cursor: pointer; }
.rest-in.over { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.toast { position: fixed; z-index: 11; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: .9rem; max-width: calc(100% - 32px); }
@media (max-width: 380px) { h1 { font-size: 1.7rem; } .tiles { grid-template-columns: 1fr 1fr; } }
@media (prefers-reduced-motion: no-preference) { .meter > i { transition: width .4s ease; } }

/* Personal bests */
.pb-row { grid-template-columns: minmax(0, 1fr) auto; }
.pb-val { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.pb-val b { font-family: var(--font-display); font-size: 1.15rem; }
.pill.pb { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.pin { color: var(--accent-text); font-size: .7rem; }

/* Appearance swatches */
.swatches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.swatch { appearance: none; display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 76px; padding: 8px 4px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink); cursor: pointer; }
.swatch[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.swatch:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.sw-chip { width: 44px; height: 44px; border-radius: 50%; border: 2px solid; display: flex; align-items: center; justify-content: center; gap: 4px; }
.sw-chip i { width: 12px; height: 12px; border-radius: 50%; }
.sw-label { font-size: .78rem; font-weight: 600; text-align: center; line-height: 1.15; }

/* Usernames */
.un-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; padding-left: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.un-wrap > span { color: var(--muted); font-weight: 600; }
.un-wrap input.in { border: 0; padding-left: 0; background: transparent; min-width: 0; }
.un-ok { color: var(--good); }
.un-bad { color: var(--muted); }

/* Gym (pilot): leaderboards, challenge podiums and staff tools */
.gym-nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 0 2px 2px; }
.gym-nav::-webkit-scrollbar { display: none; }
.gym-nav .chip { flex: none; padding: 0 12px; }
.lb { display: flex; flex-direction: column; }
.lb-row { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.lb-row:first-child { border-top: 0; }
.lb-row .pos { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--muted); text-align: center; }
.lb-row .nm { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.lb-row .v { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.lb-row.me { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-radius: 8px; margin: 0 -8px; padding-inline: 8px; border-top-color: transparent; }
.lb-row.me + .lb-row { border-top-color: transparent; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; }
.podium > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px 10px 4px 4px; padding: 10px 6px; text-align: center; min-width: 0; display: flex; flex-direction: column; gap: 3px; justify-content: flex-end; }
.podium .p1 { min-height: 118px; border-color: var(--accent); box-shadow: 0 0 16px var(--glow-lo); }
.podium .p2 { min-height: 96px; }
.podium .p3 { min-height: 82px; }
.podium b { font-family: var(--font-display); font-size: 1.6rem; line-height: 1; }
.podium .p1 b { color: var(--accent-text); }
.podium .nm { font-weight: 600; font-size: .88rem; overflow-wrap: anywhere; line-height: 1.2; }
.podium .v { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.podium .empty-slot { opacity: .55; border-style: dashed; box-shadow: none; }
.mrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.mrow:first-child { border-top: 0; }
.mrow .who { min-width: 0; overflow-wrap: anywhere; }
.mrow .who span { display: block; font-size: .82rem; color: var(--muted); }
.code-big { font-family: var(--font-display); font-weight: 700; font-size: 1.8rem; letter-spacing: .06em; overflow-wrap: anywhere; }
.pick-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.pick-list button { appearance: none; text-align: left; background: var(--surface-2); border: 0; border-top: 1px solid var(--line); padding: 10px 12px; cursor: pointer; min-height: 44px; overflow-wrap: anywhere; }
.pick-list button:first-child { border-top: 0; }
.pick-list button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--accent); }
.gym-head { display: flex; align-items: center; gap: 12px; }
.gym-head img { flex: none; width: 44px; height: 44px; }
.gym-mark { width: 18px; height: 18px; vertical-align: -4px; margin-right: 6px; }
