:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.25rem; --s6: 1.5rem; --s8: 2rem;
  --bg: #0f1115; --surface: #171a20; --surface-2: #1e222a; --line: #2a2f39; --line-2: #383e4a;
  --text: #ecebe6; --muted: #9a9ca3; --faint: #6c6f77;
  --accent: #D7F45B; --accent-ink: #151714; --accent-soft: rgba(215,244,91,.12);
  --good: #6fcf97; --good-soft: rgba(110,201,180,.12); --warn: #f08a5d; --warn-soft: rgba(242,153,74,.12);
  --p: #8FB4CC; --c: #D7F45B; --f: #c792ea;
  --r: 14px; --r-sm: 10px;
  --font-d: 'Cabinet Grotesk', 'Satoshi', system-ui, sans-serif;
  --font-b: 'Satoshi', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --tab-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { font-family: var(--font-b); font-size: var(--text-base); line-height: 1.45; color: var(--text); background: var(--bg); min-height: 100dvh; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
.view { padding: calc(var(--s5) + env(safe-area-inset-top)) var(--s4) calc(var(--tab-h) + var(--s8) + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: var(--s3); }
.view.ob { padding-bottom: calc(var(--s8) + env(safe-area-inset-bottom)); }
.view.workout { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }

h1 { font-family: var(--font-d); font-size: var(--text-xl); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
h2 { font-family: var(--font-d); font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
h3 { font-size: var(--text-base); font-weight: 700; line-height: 1.3; }
.sec { margin-top: var(--s4); }
.eyebrow { font-size: var(--text-xs); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; font-weight: 500; }
.label { font-size: var(--text-sm); font-weight: 700; margin-bottom: var(--s2); }
.small { font-size: var(--text-xs); } .muted { color: var(--muted); } .center { text-align: center; }
.empty { color: var(--faint); font-size: var(--text-sm); padding: var(--s3) 0; }
.disclaimer { margin-top: var(--s4); }

.row { display: flex; align-items: center; } .between { justify-content: space-between; gap: var(--s3); } .gap { gap: var(--s2); } .wrap { flex-wrap: wrap; } .grow { flex: 1; } .full { width: 100%; }
.left { text-align: left; }

.top { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); }
.top .iconbtn { align-self: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.card.slim { padding: var(--s3) var(--s4); gap: var(--s2); }
.card.link { text-align: left; width: 100%; transition: border-color .15s; }
.card.link:hover { border-color: var(--line-2); }
.card.is-done { opacity: .7; }
.card h2 { font-size: var(--text-lg); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s4); border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-2); font-size: var(--text-sm); font-weight: 700; white-space: nowrap; transition: background .15s, transform .08s; }
.btn:hover { background: var(--hover); } .btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #E4FA86; }
.btn.primary:disabled { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { background: var(--warn-soft); border-color: rgba(242,153,74,.35); color: var(--warn); }
.btn.big { min-height: 54px; font-size: var(--text-base); width: 100%; }
.btn.sm { min-height: 36px; padding: 0 var(--s3); font-size: var(--text-xs); }
.btn.sm .ic { width: 16px; height: 16px; }
.btn.full { width: 100%; }
.iconbtn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); }
.iconbtn:hover { background: var(--surface-2); color: var(--text); }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); } .pill .ic { width: 14px; height: 14px; }
.note { font-size: var(--text-sm); padding: var(--s3); border-radius: var(--r-sm); background: var(--accent-soft); color: var(--note-ink); }
.note.warn { background: var(--warn-soft); color: var(--warn-ink); }
.note.good { background: var(--good-soft); color: var(--good); display: flex; gap: 8px; align-items: center; justify-content: center; }

/* segmented & options */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surface); border: 1px solid var(--line); padding: 4px; border-radius: 12px; }
.seg.wrap { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
.seg button { min-height: 42px; border-radius: 9px; font-weight: 700; font-size: var(--text-sm); color: var(--muted); }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.opts { display: flex; flex-direction: column; gap: var(--s2); }
.opt { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: var(--s3) var(--s4); border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); width: 100%; margin-bottom: var(--s2); }
.opts .opt { margin: 0; }
.opt span { font-size: var(--text-xs); color: var(--muted); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); }
.opt.dim { opacity: .55; }
.daypick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.daypick button { min-height: 44px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: var(--text-xs); font-weight: 700; color: var(--muted); }
.daypick button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.daypick.mini button { min-height: 34px; }

/* onboarding */
.ob { min-height: 100dvh; }
.obbar { display: flex; align-items: center; gap: var(--s3); }
.pbar { flex: 1; height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.pbar.thin { height: 3px; flex: none; }
.obbody { display: flex; flex-direction: column; gap: var(--s4); flex: 1; padding-top: var(--s4); }
.obfoot { display: flex; flex-direction: column; gap: var(--s2); position: sticky; bottom: 0; padding: var(--s4) 0 env(safe-area-inset-bottom); background: linear-gradient(transparent, var(--bg) 30%); }
.q { font-size: var(--text-xl); font-weight: 800; letter-spacing: -0.02em; }
.hint { color: var(--muted); font-size: var(--text-sm); }
.hero { padding-top: 12vh; display: flex; flex-direction: column; gap: var(--s5); }
.hero-title { font-size: clamp(2rem, 1.4rem + 3vw, 2.75rem); line-height: 1.05; }
.lede { color: var(--muted); max-width: 46ch; }
.ticks { list-style: none; display: flex; flex-direction: column; gap: var(--s2); font-size: var(--text-sm); }
.ticks li { display: flex; gap: var(--s2); align-items: center; } .ticks .ic { color: var(--accent); }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.chk { display: flex; align-items: center; gap: var(--s2); padding: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: var(--text-sm); cursor: pointer; }
.chk input { accent-color: var(--accent); width: 18px; height: 18px; }
.sports { display: flex; flex-direction: column; gap: var(--s2); }
.sport { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s2); display: flex; flex-direction: column; gap: var(--s2); }
.sport.on { border-color: var(--accent); }
.sport-name { display: flex; align-items: center; gap: var(--s2); font-weight: 700; padding: var(--s2); text-align: left; }
.sport.on .sport-name .ic { color: var(--accent); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); }
.field span, .grid4 label span { display: block; font-size: var(--text-xs); color: var(--muted); margin-bottom: 4px; }
.inp { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding-right: var(--s3); }
.inp input { flex: 1; min-width: 0; background: none; border: 0; padding: var(--s3); font-size: var(--text-base); font-variant-numeric: tabular-nums; outline: none; }
.inp em { font-style: normal; color: var(--faint); font-size: var(--text-xs); }
.inp:focus-within { border-color: var(--accent); }
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
input[type=number] { -moz-appearance: textfield; }
.grid4 input, .custom > input, .search, select, textarea { width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: var(--s3); font-size: var(--text-base); outline: none; min-width: 0; }
.grid4 input:focus, .custom > input:focus, .search:focus, select:focus { border-color: var(--accent); }
.macros { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: var(--s2); }
.macros div { display: flex; flex-direction: column; }
.macros b { font-family: var(--font-d); font-size: var(--text-lg); font-weight: 800; }
.macros span { font-size: var(--text-xs); color: var(--muted); }

.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wd { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; min-height: 76px; display: flex; flex-direction: column; gap: 4px; text-align: center; }
.wd b { font-size: var(--text-xs); color: var(--muted); font-weight: 700; }
.wd span { font-size: 0.75rem; line-height: 1.2; color: var(--faint); display: flex; flex-direction: column; gap: 2px; }
.wd em { font-style: normal; color: var(--p); }
.wd.train { background: var(--accent-soft); border-color: rgba(215,244,91,.35); }
.wd.train span { color: var(--note-ink); font-weight: 700; }
.wd.today { box-shadow: inset 0 0 0 1.5px var(--text); }

/* today */
.dots { display: flex; gap: 6px; padding-bottom: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line-2); }
.dot.on { background: var(--accent); border-color: var(--accent); }
.session h2 { font-size: var(--text-xl); }
.modes { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.modes button { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: var(--text-xs); font-weight: 700; color: var(--muted); }
.modes button .ic { width: 15px; height: 15px; }
.modes button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.exlist { list-style: none; counter-reset: ex; display: flex; flex-direction: column; }
.exlist li { counter-increment: ex; display: flex; justify-content: space-between; gap: var(--s3); padding: 9px 0; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.exlist li:last-child { border-bottom: 0; }
.exlist .exn::before { content: counter(ex, decimal-leading-zero); color: var(--faint); margin-right: 10px; font-variant-numeric: tabular-nums; font-size: var(--text-xs); }
.seg.three { grid-auto-columns: 1fr; }
.bars { display: flex; flex-direction: column; gap: var(--s2); flex: 1; }
.bars > div, .hbars > div { display: grid; grid-template-columns: 70px 1fr auto; gap: var(--s2); align-items: center; font-size: var(--text-xs); }
.bars span, .hbars span { color: var(--muted); }
.bars b, .hbars b { font-weight: 500; min-width: 64px; text-align: right; }
.bar { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.bar.p i { background: var(--p); } .bar.c i { background: var(--c); } .bar.f i { background: var(--f); }
.hbars { display: flex; flex-direction: column; gap: var(--s2); }
.hbars > div { grid-template-columns: 110px 1fr 28px; }
.hbars b { min-width: 0; }
.done-card { border-color: rgba(110,201,180,.35); }
.weeknote { padding: 0 var(--s1); }

/* workout */
.wtop { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s3); position: sticky; top: 0; z-index: 5; background: var(--bg); padding: var(--s3) 0 var(--s2); margin-top: calc(-1 * var(--s3)); }
.wstat { display: flex; flex-direction: column; align-items: flex-end; }
.wstat b { font-family: var(--font-d); font-size: var(--text-lg); font-weight: 800; }
.excard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4) var(--s3) var(--s3); display: flex; flex-direction: column; gap: var(--s3); scroll-margin-top: 90px; }
.excard.complete { border-color: rgba(110,201,180,.4); }
.exhead { display: flex; justify-content: space-between; gap: var(--s2); padding: 0 var(--s1); }
.exhead h3 { font-size: var(--text-lg); font-family: var(--font-d); font-weight: 700; margin: 2px 0; }
.suggest { font-size: var(--text-sm); color: var(--muted); background: var(--bg); border-radius: var(--r-sm); padding: var(--s2) var(--s3); display: flex; gap: 6px; align-items: flex-start; }
.suggest.up { color: var(--note-ink); background: var(--accent-soft); }
.suggest.down { color: var(--warn-ink); background: var(--warn-soft); }
.suggest .ic { width: 16px; height: 16px; margin-top: 2px; }
.cues { padding-left: 1.2rem; font-size: var(--text-sm); color: var(--text); display: flex; flex-direction: column; gap: 4px; }
.cues.big { font-size: var(--text-base); gap: var(--s2); margin: var(--s3) 0; }
.sets { display: flex; flex-direction: column; gap: 6px; }
.sethead, .setrow { display: grid; grid-template-columns: 32px 1fr 76px 76px 48px; gap: 6px; align-items: center; }
.sethead { font-size: var(--text-xs); color: var(--faint); padding: 0 2px; }
.sethead span:nth-child(n+3) { text-align: center; }
.setrow { padding: 2px; border-radius: 10px; }
.setrow.done { background: var(--good-soft); }
.setn { text-align: center; font-weight: 700; color: var(--muted); }
.prev { font-size: var(--text-xs); }
.setrow input { width: 100%; height: 44px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg); text-align: center; font-size: var(--text-base); font-weight: 700; font-variant-numeric: tabular-nums; outline: none; }
.setrow input:focus { border-color: var(--accent); }
.setrow input::placeholder { color: var(--faint); font-weight: 500; }
.tick { height: 44px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--faint); }
.tick.on { background: var(--good); border-color: var(--good); color: #0b1a11; }
.exfoot { flex-wrap: wrap; gap: var(--s2); }
.rpe { display: flex; align-items: center; gap: 3px; }
.rpe span { margin-right: 4px; }
.rpe button { width: 32px; height: 32px; border-radius: 8px; font-size: var(--text-xs); font-weight: 700; color: var(--muted); border: 1px solid var(--line); }
.rpe button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.wfoot { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s3); }
.rest { position: fixed; left: 50%; bottom: calc(var(--s4) + env(safe-area-inset-bottom)); transform: translate(-50%, 150%); width: min(528px, calc(100% - 2rem)); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 18px; padding: var(--s3) var(--s4); display: flex; justify-content: space-between; align-items: center; gap: var(--s3); box-shadow: 0 12px 40px rgba(0,0,0,.5); transition: transform .25s ease; z-index: 20; }
.rest.show { transform: translate(-50%, 0); }
.rest-ring { display: flex; align-items: baseline; gap: 8px; }
.rest-ring b { font-family: var(--font-d); font-size: var(--text-xl); font-weight: 800; color: var(--accent); }
.rest-ring span { color: var(--muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .06em; }

/* plan */
.weeks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.wk { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; }
.wk b { font-family: var(--font-d); font-weight: 800; }
.wk span { font-size: var(--text-xs); color: var(--muted); }
.wk.on { border-color: var(--accent); background: var(--accent-soft); }
.wk.past { opacity: .5; }
.card > button.row { width: 100%; text-align: left; }
.prose p { font-size: var(--text-sm); color: var(--muted); }
.prose b { color: var(--text); }

/* food */
.ringrow { display: flex; gap: var(--s4); align-items: center; }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .trk { stroke: var(--line); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .4s; }
.ring > div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring b { font-family: var(--font-d); font-size: var(--text-lg); font-weight: 800; }
.ring span { font-size: var(--text-xs); color: var(--muted); }
.fuel .bars > div { grid-template-columns: 52px 1fr auto; }
.meal h3 { font-size: var(--text-base); }
.ing { color: var(--muted); line-height: 1.6; }
.ing .num { color: var(--text); }
.toggle { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--muted); cursor: pointer; margin-top: var(--s4); }
.toggle input { accent-color: var(--accent); width: 18px; height: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s4); }
.chip { white-space: nowrap; padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: var(--text-xs); font-weight: 500; }
.chip:hover { border-color: var(--line-2); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.log { list-style: none; display: flex; flex-direction: column; }
.log li { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 10px 0; border-bottom: 1px solid var(--line); }
.log li > div { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.log li b { font-size: var(--text-sm); }
.log.tight li { padding: 8px 0; font-size: var(--text-sm); }

/* progress */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.stat { padding: var(--s3); gap: 2px; }
.stat b { font-family: var(--font-d); font-size: var(--text-xl); font-weight: 800; }
.stat span { font-size: var(--text-xs); color: var(--muted); line-height: 1.2; }
.chart svg { width: 100%; height: auto; display: block; }
.cl-line { fill: none; stroke: var(--accent); stroke-width: 2; }
.cl-raw { fill: none; stroke: var(--line-2); stroke-width: 1.2; }
.cl-avg { fill: none; stroke: var(--accent); stroke-width: 2.2; }
.cl-pt { fill: var(--accent); }
.cl-ax { stroke: var(--line); }
.cl-t { fill: var(--faint); font-size: 10px; font-family: var(--font-b); }
.hist h3 { font-size: var(--text-base); }
.hist .row { align-items: flex-end; }
.histex { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* more / library */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--s4); font-size: var(--text-sm); }
.kv dt { color: var(--muted); } .kv dd { text-align: right; }
.search { margin-bottom: 2px; }
.lib { flex-direction: row; justify-content: space-between; align-items: center; margin-bottom: var(--s2); }
#libres { display: flex; flex-direction: column; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 45%; }
.tags i { font-style: normal; font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.dump { min-height: 160px; font-family: ui-monospace, monospace; font-size: 12px; margin: var(--s3) 0; }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr); max-width: 560px; margin: 0 auto; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--tabbar-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font-size: 0.75rem; font-weight: 700; }
.tab.on { color: var(--accent); }

/* sheet & toast */
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); opacity: 0; visibility: hidden; pointer-events: none; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: var(--text-sm); font-weight: 700; z-index: 40; transition: opacity .2s, transform .25s, visibility .2s; max-width: calc(100% - 2rem); text-align: center; }
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.sheet { position: fixed; inset: 0; z-index: 30; display: none; }
.sheet.show { display: block; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.6); animation: fade .2s; }
.sheet-body { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: min(560px, 100%); max-height: 86dvh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 20px 20px 0 0; padding: var(--s6) var(--s4) calc(var(--s6) + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: var(--s3); animation: up .25s ease; }
.sheet-body .opt { margin: 0; }
.summary { align-items: center; gap: var(--s4); display: flex; flex-direction: column; }
.summary .macros { width: 100%; text-align: center; }
@keyframes up { from { transform: translate(-50%, 30%); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

@media (max-width: 380px) {
  .sethead, .setrow { grid-template-columns: 26px 1fr 66px 66px 44px; }
  .ringrow { flex-direction: column; align-items: stretch; } .ring { align-self: center; }
}
@media (min-width: 700px) {
  body { background: radial-gradient(1200px 600px at 50% -10%, #1a1d24, var(--bg)); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ===== v2: wheels, body map, tables, charts, nutrition ===== */
a { color: var(--accent); }
.field { display: block; min-width: 0; }
.field span span { display: inline; margin: 0; }
.field input:not([type=checkbox]):not([type=file]), .field select { width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: var(--s3); font-size: var(--text-base); outline: none; min-width: 0; }
.field input:focus, textarea:focus { border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); align-items: end; }
.opts.two { display: grid; grid-template-columns: 1fr 1fr; }
.seg.subtabs { margin-bottom: 2px; }
.seg.inc button, .seg.five button { min-height: 38px; font-size: var(--text-xs); }
.goodt { color: var(--good); } .warnt { color: var(--warn); }
.big { font-family: var(--font-d); font-size: 2.5rem; font-weight: 800; line-height: 1; }
.pill.warnp { background: var(--warn-soft); color: var(--warn); }
.note.link { display: block; width: 100%; text-align: left; }
.iconbtn.has { color: var(--accent); } .iconbtn.sm { width: 32px; height: 32px; } .iconbtn:disabled { opacity: .3; cursor: default; }
.card.slim > .btn.sm.ghost { align-self: flex-start; padding: 0; }
.authform { display: flex; flex-direction: column; gap: var(--s3); }
.auth .hero { padding-top: 6vh; }
.recovery { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-lg); text-align: center; padding: var(--s4); background: var(--bg); border: 1px dashed var(--line-2); border-radius: var(--r-sm); user-select: all; letter-spacing: .04em; margin: var(--s3) 0; }
.syncdot { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--muted); }
.syncdot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.syncdot.good::before { background: var(--good); } .syncdot.warn::before { background: var(--warn); }

/* number buttons */
.numbtn { display: inline-flex; align-items: baseline; justify-content: center; gap: 6px; width: 100%; min-height: 52px; padding: var(--s2) var(--s3); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.numbtn:hover { border-color: var(--accent); }
.numbtn b { font-family: var(--font-d); font-size: var(--text-lg); font-weight: 800; }
.numbtn em { font-style: normal; font-size: var(--text-xs); color: var(--muted); }
.numbtn.sm { width: auto; min-width: 76px; min-height: 42px; }
.numbtn.sm b { font-size: var(--text-base); }
.lifts { display: flex; flex-direction: column; gap: var(--s2); }
.liftrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); }
.liftrow .ln { flex: 1 1 96px; font-weight: 700; font-size: var(--text-sm); }
.liftrow .e1 { flex: 1 1 0; order: 5; }
.liftrow .iconbtn { margin-left: auto; order: 6; width: 32px; height: 32px; }
.liftrow::after { content: ''; flex: 1 1 100%; order: 4; height: 0; }
.liftrow:not(:has(.e1))::after { display: none; }

/* wheel picker */
.wheels { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.wheels.one { grid-template-columns: minmax(0, 240px); justify-content: center; }
.wheels.three { grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.wheels > div { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.wlabel { font-size: var(--text-xs); color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: .06em; }
.wheelwrap { position: relative; height: 200px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.wheels.short .wheelwrap { height: 120px; }
.wheelwrap::before { content: ''; position: absolute; left: 6px; right: 6px; top: 50%; height: 40px; transform: translateY(-50%); border-radius: 10px; background: var(--accent-soft); border: 1px solid rgba(215,244,91,.4); pointer-events: none; }
.wheelwrap::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(var(--bg), var(--wheel-fade) 36%, var(--wheel-fade) 64%, var(--bg)); }
.wheel { height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; padding: 80px 0; overscroll-behavior: contain; outline: none; touch-action: pan-y; }
.wheel::-webkit-scrollbar { display: none; }
.wheels.short .wheel { padding: 40px 0; }
.wheel:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: var(--r); }
.wi { height: 40px; display: flex; align-items: center; justify-content: center; scroll-snap-align: center; font-size: var(--text-base); font-weight: 700; color: var(--faint); font-variant-numeric: tabular-nums; cursor: pointer; user-select: none; }
.wi.sel { color: var(--text); font-family: var(--font-d); font-size: 1.6rem; font-weight: 800; }
.wunit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: var(--text-xs); color: var(--muted); pointer-events: none; z-index: 1; }
.typein { display: flex; flex-direction: column; gap: 4px; }
details.typein summary { font-size: var(--text-xs); color: var(--muted); cursor: pointer; padding: 6px 0; }
.sheet-body > .row.center, .wheels .row.center { justify-content: center; }

/* set rows as buttons */
.setrow .setn { height: 44px; border-radius: 9px; }
.setrow .setn:hover { background: var(--surface-2); }
.setrow.t-w .setn { color: var(--p); } .setrow.t-d .setn { color: var(--f); } .setrow.t-f .setn { color: var(--warn); }
.setrow.t-w { opacity: .85; }
.val { height: 44px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg); text-align: center; font-size: var(--text-base); font-weight: 700; }
.val:hover { border-color: var(--accent); }
.val.ph { color: var(--faint); font-weight: 500; }
.exnote { width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: var(--s2) var(--s3); font-size: var(--text-sm); resize: vertical; outline: none; }
.lastnote { padding: 0 var(--s1); }
.pickres { display: flex; flex-direction: column; max-height: 46dvh; overflow-y: auto; margin: var(--s3) 0; }
.pickres.tall { max-height: 48dvh; min-height: 30dvh; }
.pickres .eyebrow { margin: var(--s2) 0; }
.pickres.swapres { gap: var(--s2); margin: 0; }
.swapres > .opt { flex-shrink: 0; }
.lib.food .ic { color: var(--muted); }
.lib.food > div { min-width: 0; }
.recs { list-style: none; counter-reset: rec; display: flex; flex-direction: column; gap: var(--s3); margin: var(--s3) 0; }
.recs li { counter-increment: rec; display: flex; flex-direction: column; gap: 2px; padding-left: 30px; position: relative; font-size: var(--text-sm); }
.recs li::before { content: counter(rec); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: var(--text-xs); font-weight: 700; display: grid; place-items: center; }
.recs span { color: var(--muted); }

/* body map */
.bodymap { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); width: 100%; max-width: 330px; margin: 0 auto; }
.bodymap.small { max-width: 150px; gap: 4px; }
.bm-side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bm-side svg { width: 100%; height: auto; display: block; overflow: visible; }
.bm-side figcaption { font-size: var(--text-xs); color: var(--faint); }
.bodymap.small figcaption { display: none; }
.bm-base { fill: var(--bm-base); }
.bm-hair { fill: #5a4a3e; pointer-events: none; }
html[data-theme=light] .bm-hair { fill: #9c8573; }
.ms-hair { fill: rgba(40,44,110,.28); }
.bm-ln { stroke: var(--bm-gap); stroke-width: 1.2; fill: none; pointer-events: none; }
.mz { stroke: var(--bm-gap); stroke-width: 1.1; stroke-linejoin: round; transition: fill .2s; }
.mz[role=button] { cursor: pointer; outline: none; }
.mz[role=button]:hover { filter: brightness(1.15); }
.mz:focus-visible { stroke: var(--text); stroke-width: 2.2; }
.mz.s-off, .mz.s-none { fill: var(--bm-off); } .mz.s-ok { fill: var(--good); } .mz.s-mid { fill: var(--accent); } .mz.s-low { fill: var(--warn); } .mz.s-hit { fill: var(--accent); } .mz.s-hit2 { fill: rgba(215,244,91,.42); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--text-xs); color: var(--muted); justify-content: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.legend i.s-ok { background: var(--good); } .legend i.s-mid, .legend i.s-hit { background: var(--accent); } .legend i.s-low { background: var(--warn); } .legend i.s-none { background: var(--bm-off); }
.linkrow { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); width: 100%; text-align: left; min-height: 28px; }
@media (hover: hover) { .linkrow:hover > span:first-child { color: var(--accent); } }
.linkrow.food .fn { display: flex; flex-direction: column; min-width: 0; }
.linkrow.food b { font-size: var(--text-sm); }
.log li > .linkrow { flex: 1; }
.sessgrid { display: grid; grid-template-columns: 1fr 124px; gap: var(--s3); align-items: center; }
.sessmap { display: flex; flex-direction: column; gap: 4px; }
.summary .bodymap.small { max-width: 180px; }

/* tables */
.tblwrap { overflow-x: auto; margin: 0 calc(-1 * var(--s1)); }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--text-xs); }
.tbl th { color: var(--muted); font-weight: 500; text-align: right; padding: 6px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl tr:last-child td { border-bottom: 0; }
.tlink { text-align: left; color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.tlink:hover { color: var(--accent); }

/* bars with zones, nutrient rows */
.bar.zone { position: relative; height: 8px; overflow: visible; }
.bar.zone::before { content: ''; position: absolute; top: -3px; bottom: -3px; left: var(--zl); width: var(--zw); background: var(--zone); border-radius: 3px; }
.bar.zone i { position: relative; background: var(--good); min-width: 2px; }
.bar.zone i.lowv { background: var(--accent); } .bar.zone i.highv { background: var(--warn); }
.hbars.wide > div { grid-template-columns: 96px 1fr 34px; }
.bars.wide > div { grid-template-columns: 84px 1fr auto; }
.bar.w i { background: var(--p); }
.ring.over .val { stroke: var(--warn); }
.nrows { display: flex; flex-direction: column; }
.nrow { display: grid; grid-template-columns: 118px 1fr auto; gap: var(--s2); align-items: center; font-size: var(--text-xs); padding: 7px 0; width: 100%; text-align: left; }
.nrow span { color: var(--muted); } .nrow b { font-weight: 500; min-width: 92px; text-align: right; }
.nrow.static b { min-width: 44px; }
@media (hover: hover) { button.nrow:hover span { color: var(--accent); } }
.bar.n-ok i { background: var(--good); } .bar.n-lo i { background: var(--accent); } .bar.n-hi i { background: var(--warn); } .bar.n-in i { background: var(--line-2); }
.sd { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; } .sd.lo { background: var(--accent); } .sd.hi { background: var(--warn); }
details.nsec, details.more { border-top: 1px solid var(--line); }
details.nsec:first-of-type { border-top: 0; }
details.nsec > summary, details.more > summary { padding: 10px 0; font-weight: 700; font-size: var(--text-sm); cursor: pointer; list-style-position: inside; }
details.more > summary { font-weight: 500; color: var(--muted); font-size: var(--text-xs); }
details.nsec > p { padding-bottom: var(--s3); }
.fix { display: flex; flex-direction: column; gap: 6px; }
.chips.center { justify-content: center; } .macros.center { text-align: center; }
.chip .muted { margin-left: 4px; }

/* fuel */
.datenav { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 2px; }
.datebtn { flex: 1; min-height: 40px; font-family: var(--font-d); font-weight: 700; }
.slotgrp + .slotgrp { margin-top: var(--s3); }
.slothead { padding-bottom: 2px; border-bottom: 1px solid var(--line-2); }
.meal { border-top: 1px solid var(--line); padding-top: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.toggle.inline { margin-top: 0; white-space: nowrap; }
.fuel .bars .row { display: flex; grid-template-columns: none; }
.sheet-body.tallsheet { min-height: 80dvh; }
input[type=file] { font-size: var(--text-xs); color: var(--muted); margin: var(--s3) 0; width: 100%; }

/* progress */
.rangebar { display: flex; gap: 6px; }
.rangebar button { flex: 1; min-height: 34px; border-radius: 999px; border: 1px solid var(--line); font-size: var(--text-xs); font-weight: 700; color: var(--muted); }
.rangebar button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chartbox { position: relative; width: 100%; }
.chartbox canvas { position: absolute; inset: 0; }
.stat .of { font-size: var(--text-sm); color: var(--muted); font-weight: 500; }
.std { display: flex; flex-direction: column; gap: 6px; padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.stdbar { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); height: 22px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.stdbar span { font-size: 10px; color: var(--faint); text-align: center; line-height: 20px; border-left: 1px solid var(--line); }
.stdbar span:first-of-type { border-left: 0; }
.stdbar i { position: absolute; top: -4px; bottom: -4px; width: 4px; background: var(--accent); border-radius: 2px; transform: translateX(-50%); z-index: 1; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: var(--s2); }
.mgrid .numbtn.sm { width: 100%; }
.kv dd .numbtn.sm { min-height: 34px; min-width: 64px; }

@media (max-width: 380px) {
  .sessgrid { grid-template-columns: 1fr 96px; }
  .nrow { grid-template-columns: 96px 1fr auto; } .nrow b { min-width: 78px; }
  .opts.two { grid-template-columns: 1fr; }
  .wi.sel { font-size: 1.35rem; }
}
.exlist li > .num { white-space: nowrap; flex: none; }
.exlist li { align-items: baseline; }
.tbl td:first-child { white-space: nowrap; }
.nw { white-space: nowrap; }
@media (max-width: 480px) { .hide-s { display: none; } }
.sheet-body > .row.sticky { position: sticky; bottom: calc(-1 * var(--s6) - env(safe-area-inset-bottom)); margin: 0 calc(-1 * var(--s4)) calc(-1 * var(--s6) - env(safe-area-inset-bottom)); padding: var(--s3) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); z-index: 3; }
.sheet.show ~ .toast { bottom: auto; top: calc(var(--s4) + env(safe-area-inset-top)); }

/* ---------- calendar and flexible scheduling ---------- */
:root { --plan: #D7F45B; --plan-soft: rgba(215,244,91,.13); --miss: #EF6A5A; --miss-soft: rgba(239,106,90,.14); --info: #8FB4CC; --info-soft: rgba(143,180,204,.12); }
.calnav { display: flex; align-items: center; gap: 2px; }
.caltitle { flex: 1; font-size: var(--text-lg); padding: 0 var(--s1); min-width: 0; }
.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cwd { font-size: var(--text-xs); color: var(--faint); text-align: center; font-weight: 700; padding-bottom: 2px; }
.cd { position: relative; aspect-ratio: 1 / 1.05; min-height: 44px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; transition: border-color .15s, background .15s; }
.cd b { font-size: var(--text-sm); font-weight: 500; line-height: 1; }
.cd.out { opacity: .38; }
.cd:hover { border-color: var(--line-2); }
.cd.today b { font-weight: 800; color: var(--text); }
.cd.today::after { content: ''; position: absolute; top: 5px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--text); }
.cd.sel { box-shadow: inset 0 0 0 1.5px var(--text); border-color: var(--text); }
.cd.trv { background-image: linear-gradient(135deg, transparent 0 78%, var(--info-soft) 78%); }
.mk { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 800; line-height: 1; flex: none; }
.mk .ic { width: 11px; height: 11px; stroke-width: 2.6; }
.st-rest .mk, .st-none .mk { width: 5px; height: 5px; background: var(--line-2); }
.st-none .mk { background: transparent; }
.st-done .mk { background: var(--good); color: #0c1f14; }
.st-planned .mk { border: 2px solid var(--plan); }
.st-missed .mk { background: var(--miss); color: #230b05; }
.st-skipped .mk { width: 12px; height: 3px; border-radius: 2px; background: var(--faint); }
.st-moved .mk { color: var(--muted); border: 1.5px dashed var(--line-2); }
.st-travel .mk { color: var(--info); } .st-travel .mk .ic { width: 14px; height: 14px; stroke-width: 1.8; }
.cd.st-done { background: var(--good-soft); border-color: rgba(110,201,180,.3); }
.cd.st-planned { background: var(--plan-soft); border-color: rgba(215,244,91,.28); }
.cd.st-missed { background: var(--miss-soft); border-color: rgba(239,106,90,.4); }
.cd.st-travel { background: var(--info-soft); border-color: rgba(143,180,204,.22); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--text-xs); color: var(--muted); padding: 2px 2px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; min-height: 18px; }
.legend .st-rest .mk { width: 6px; height: 6px; margin: 0 5px; }
.wklist { display: flex; flex-direction: column; gap: 4px; }
.wkrow { display: grid; grid-template-columns: 44px 18px 1fr auto; align-items: center; gap: var(--s3); text-align: left; padding: 10px var(--s3); min-height: 56px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); border-left-width: 3px; }
.wkrow:hover { border-color: var(--line-2); }
.wkrow.today { box-shadow: inset 0 0 0 1px var(--line-2); }
.wkrow .mk { justify-self: center; }
.wkd { display: flex; flex-direction: column; line-height: 1.15; } .wkd b { font-size: var(--text-xs); color: var(--muted); } .wkd span { font-family: var(--font-d); font-weight: 800; font-size: var(--text-lg); }
.wkt { min-width: 0; display: flex; flex-direction: column; } .wkt b { font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .wkt span { font-size: var(--text-xs); color: var(--info); }
.wkr { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; }
.wkrow.st-done { border-left-color: var(--good); } .wkrow.st-planned { border-left-color: var(--plan); } .wkrow.st-missed { border-left-color: var(--miss); } .wkrow.st-travel { border-left-color: var(--info); }
.wkrow.st-rest .wkt b, .wkrow.st-none .wkt b { color: var(--faint); font-weight: 500; }
.daypanel { display: flex; flex-direction: column; gap: var(--s3); }
.daypanel .sec { margin-top: var(--s2); }
.daycard { border-left-width: 3px; }
.daycard.st-done { border-left-color: var(--good); } .daycard.st-planned { border-left-color: var(--plan); } .daycard.st-missed { border-left-color: var(--miss); } .daycard.st-travel { border-left-color: var(--info); }
.st-pill.st-done { background: var(--good-soft); color: var(--good); } .st-pill.st-planned { background: var(--plan-soft); color: var(--note-ink); } .st-pill.st-missed { background: var(--miss-soft); color: var(--miss-ink); } .st-pill.st-travel { background: var(--info-soft); color: var(--info); }
.exnote-line { color: var(--note-ink); }
.chip.static { cursor: default; } .chip.static:hover { border-color: var(--line); }
.missedcard { border-color: rgba(239,106,90,.4); border-left: 3px solid var(--miss); }
.sessacts { margin-top: calc(-1 * var(--s1)); } .sessacts .btn { padding: 0 var(--s2); }
.note.plain { display: flex; gap: var(--s2); align-items: flex-start; text-align: left; width: 100%; background: var(--info-soft); color: var(--info-ink); }
.note.plain .ic { margin-top: 2px; color: var(--info); }
.dot.skip { border-style: dashed; }
.wd.did { background: var(--good-soft); border-color: rgba(110,201,180,.3); } .wd.did span { color: var(--good); }
.daypick.wide button { min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.daypick.wide button span { font-weight: 500; opacity: .8; } .daypick button:disabled { opacity: .3; cursor: not-allowed; }
.check { display: flex; align-items: center; gap: var(--s2); font-size: var(--text-sm); min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.mvgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: var(--s2) 0; }
.mvd { min-height: 64px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 4px 2px; }
.mvd b { font-size: var(--text-xs); } .mvd span { font-size: 0.6875rem; color: var(--muted); } .mvd em { font-style: normal; font-size: 0.625rem; color: var(--plan); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 12px; }
.mvd.on { border-color: var(--accent); background: var(--accent-soft); } .mvd:hover { border-color: var(--line-2); }
.switch { width: 50px; height: 30px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); position: relative; flex: none; transition: background .15s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch.on { background: var(--accent); border-color: var(--accent); } .switch.on i { transform: translateX(20px); background: var(--accent-ink); }
.btn.on { border-color: var(--accent); color: var(--accent); }
.weekcard .chips { gap: 6px; }
input[type=date], input[type=time] { color-scheme: dark; }

/* ---------- account: devices and sign-in ---------- */
.devlist { display: flex; flex-direction: column; gap: var(--s2); margin: var(--s3) 0; }
.devrow { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.devrow > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.devrow b { font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.devrow span:not(.pill) { font-size: var(--text-xs); color: var(--muted); }
.authform .check { min-height: 36px; margin-top: calc(-1 * var(--s1)); }
.authform #remhint { margin-top: calc(-1 * var(--s3)); }
.authform .chips { margin-bottom: calc(-1 * var(--s1)); }

/* ---------- exercise library: figures, filters, guide ---------- */
.fig { display: block; width: 100%; height: auto; }
.thumb { flex: none; width: 52px; height: 52px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; display: block; }
.lib.ex { gap: var(--s3); justify-content: flex-start; text-align: left; padding-left: var(--s3); }
.lib.ex > .grow { min-width: 0; }
.lib.ex h3 { overflow-wrap: anywhere; }
.lib.ex .tags { max-width: 34%; align-items: center; }
.lvl { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; margin-right: 2px; }
.lvl b { width: 3px; border-radius: 1px; background: var(--line-2); }
.lvl b:nth-child(1) { height: 5px; } .lvl b:nth-child(2) { height: 8px; } .lvl b:nth-child(3) { height: 12px; }
.lvl.l1 b:nth-child(1), .lvl.l2 b:nth-child(-n+2), .lvl.l3 b { background: var(--accent); }
.libact { margin-top: var(--s2); }
#libres { margin-top: var(--s3); }
.figs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin: var(--s3) 0 var(--s2); }
.figs.one { grid-template-columns: minmax(0, 320px); justify-content: center; }
.figbox { margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s2) var(--s2) var(--s1); display: flex; flex-direction: column; }
.figbox figcaption { font-size: var(--text-xs); color: var(--muted); text-align: center; letter-spacing: .04em; text-transform: uppercase; padding: 2px 0 4px; }
.exmus { margin-top: var(--s4); align-items: start; }
.exmus p { margin-bottom: 2px; }
#exguide .label { margin-top: var(--s4); }
.cues.plain { list-style: none; padding-left: 0; gap: 6px; margin-bottom: var(--s2); }
.cues.plain li { position: relative; padding-left: 18px; }
.cues.plain li::before { content: ''; position: absolute; left: 3px; top: .55em; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.cues.plain.good li::before { background: var(--accent); }
.cues.plain.bad li::before { background: transparent; border: 1.5px solid var(--muted); width: 7px; height: 7px; top: .5em; }
.exlinks { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s3); }
.exlink { display: flex; align-items: center; gap: var(--s3); text-align: left; width: 100%; padding: 6px var(--s3) 6px 6px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); }
.exlink .thumb { width: 44px; height: 44px; border-radius: 10px; }
.exlink span:last-child { display: flex; flex-direction: column; min-width: 0; }
.exlink b { font-size: var(--text-sm); font-weight: 600; overflow-wrap: anywhere; }
.exlink small { font-size: var(--text-xs); color: var(--muted); }
@media (hover: hover) { .exlink:hover { border-color: var(--line-2); } }
.cuebox { display: grid; grid-template-columns: 1fr; gap: var(--s3); margin: var(--s2) 0; }
.cuebox .btn { margin-top: var(--s2); }
.cuefig.figs { max-width: 340px; width: 100%; margin: 0 auto; }
.cuefig.figs.one { grid-template-columns: minmax(0, 170px); }
.opt.swapopt { display: grid; grid-template-columns: 44px 1fr; column-gap: var(--s3); align-items: center; }
.opt.swapopt .thumb { grid-row: 1 / span 3; width: 44px; height: 44px; border-radius: 10px; }
.opt.swapopt > strong, .opt.swapopt > span:not(.thumb) { grid-column: 2; min-width: 0; }
@media (max-width: 380px) { .lib.ex .tags i:nth-of-type(2) { display: none; } }
#exguide .cues.big { font-size: var(--text-sm); font-weight: 400; margin: 0 0 var(--s2); gap: 6px; }
#exguide .cues.big li::marker { color: var(--muted); font-weight: 600; }
.thumb { width: 56px; height: 56px; }

/* ---------- phase 4: my meals, local units, barcode, reports, supplements ---------- */
.faint { color: var(--faint); }
.mmhead { margin-top: var(--s2); } .mmhead .sec { margin-top: 0; }
.mmstrip { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s4) 2px; scroll-snap-type: x proximity; }
.mmstrip::-webkit-scrollbar { display: none; }
.mmcard { flex: none; width: min(62%, 220px); text-align: left; display: flex; flex-direction: column; gap: 2px; padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); scroll-snap-align: start; transition: border-color .15s; }
.mmcard:hover { border-color: var(--line-2); }
.mmcard b { font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mmhint .btn { align-self: flex-start; }
.slothead .iconbtn.sm { margin: -4px -6px -2px 0; }
.mlitems li > div b { overflow-wrap: anywhere; }
.ginp { width: 108px; flex: none; }
.ginp input { padding: 10px 6px 10px var(--s3); text-align: right; width: 100%; }
.unitrow { display: flex; align-items: center; justify-content: center; gap: var(--s3); }
.unitrow[hidden] { display: none; }
.unitrow p { min-width: 170px; text-align: center; display: flex; flex-direction: column; }
.unitrow b { font-family: var(--font-d); font-size: var(--text-lg); font-weight: 800; line-height: 1.15; }
.unitrow .iconbtn { background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); width: 44px; height: 44px; }
.chips.regions { flex: none; padding-bottom: 2px; }
.sheet-body .chips.regions .chip { background: var(--surface-2); }
.sheet-body .chips.regions .chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.mmstrip { flex: none; }
.chips.regions::-webkit-scrollbar { display: none; }
.filebtn { cursor: pointer; position: relative; }
.filebtn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); }
#scanres .note { display: flex; flex-direction: column; gap: var(--s2); align-items: flex-start; margin: var(--s3) 0; }
textarea { resize: vertical; min-height: 64px; display: block; }
.supps .label { display: flex; align-items: center; gap: 6px; margin: 0; }
.supps > .btn { align-self: flex-start; }
.supplist li { padding: 0; }
.suppck { display: flex; align-items: center; gap: var(--s3); width: 100%; text-align: left; padding: 10px 0; min-height: 48px; }
.suppck .ck { width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; color: var(--accent-ink); transition: background .15s, border-color .15s; }
.suppck .ck .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.suppck.on .ck { background: var(--good); border-color: var(--good); }
.suppck .fn { display: flex; flex-direction: column; min-width: 0; }
.suppck b { font-size: var(--text-sm); }
.suppck.on b { color: var(--muted); }
.suppitem h3 { font-size: var(--text-base); }
.sdots { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; max-width: 300px; }
.sdots i { display: block; aspect-ratio: 1; border-radius: 50%; }
.sdots i.tk, .legend.sleg i.tk { background: var(--good); }
.sdots i.du, .legend.sleg i.du { box-shadow: inset 0 0 0 1.5px var(--line-2); }
.sdots i.no { background: var(--line); transform: scale(.4); }
.sdots i.td { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.legend.sleg { justify-content: flex-start; }
.legend.sleg i { border-radius: 50%; margin-right: 0; }
.legend.sleg i.no { background: var(--line-2); width: 5px; height: 5px; margin: 0 2.5px; }
.chip.ck { cursor: pointer; position: relative; min-width: 44px; text-align: center; padding: 10px 12px; }
.chip.ck input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.chip.ck:has(input:checked) { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.ck:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.field[hidden], .unitrow[hidden], .btn[hidden], .chips[hidden], .field .chips[hidden] { display: none; }
.daychips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.daychips .chip.ck { min-width: 0; padding: 11px 0; }
form[data-form="supp"] .grid2 .field :is(input, select) { height: 50px; }
form[data-form="supp"] .grid2 .field :is(input, select) { display: block; }

/* ---------- phase 5: hand portion guide, recipes ---------- */
.handic { width: 56px; height: 56px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; color: var(--muted); }
.handic .hl { fill: var(--accent-soft); stroke: var(--accent); }
.handic .hl.dash { stroke-dasharray: 3 3; }
.handic.sm { width: 18px; height: 18px; stroke-width: 3.2; margin: -3px 5px -3px -2px; vertical-align: middle; color: currentColor; }
.handic.sm .hl { fill: none; stroke: currentColor; }
.chip.handchip { display: inline-flex; align-items: center; border-color: var(--line-2); }
.chip.handchip.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.handbox { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.handbox[hidden], .handslide[hidden] { display: none; }
.handgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.handcard { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: var(--s3) var(--s1); border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); text-align: center; min-height: 112px; transition: border-color .15s, background .15s; }
.handcard b { font-size: var(--text-sm); line-height: 1.2; }
.handcard:hover { border-color: var(--line-2); }
.handcard.on { border-color: var(--accent); background: var(--accent-soft); }
.handcard.on .handic { color: var(--text); }
.seg.four button { min-height: 38px; font-size: var(--text-xs); padding: 0 2px; }
.handslide { display: flex; align-items: center; gap: var(--s3); }
.handslide input { flex: 1; accent-color: var(--accent); min-height: 32px; }
.handslide b { min-width: 3.2em; text-align: right; }
.handlist { list-style: none; display: flex; flex-direction: column; gap: var(--s3); }
.handlist li { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.handlist li > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.svrow { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.svrow b { min-width: 6.5em; text-align: center; font-weight: 700; }
.svrow .iconbtn { background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); width: 40px; height: 40px; }
.svrow span { flex-basis: 100%; }
.unitrow.mlport { margin: var(--s1) 0; }

/* ---------- phase 6–7: flights, streak, awards, progress photos, privacy ---------- */
.textlink { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font: inherit; }
.plainlist { list-style: none; display: flex; flex-direction: column; gap: var(--s2); padding-bottom: var(--s3); }
.plainlist li { padding-left: 14px; position: relative; }
.plainlist li::before { content: ''; position: absolute; left: 0; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--line-2); }
.seg.subtabs.four button { font-size: var(--text-sm); padding: 0 2px; min-height: 42px; }
@media (max-width: 380px) { .seg.subtabs.four button { font-size: var(--text-xs); } }
.btn.sm.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.flcard { border-left: 3px solid var(--info); }
.flcard h3 { display: flex; align-items: center; gap: 8px; }
.flcard h3 .ic { width: 18px; height: 18px; color: var(--info); flex: none; }
.flcard .row.gap.wrap { margin-top: var(--s1); }

.mascot { width: 72px; height: 72px; flex: none; display: block; }
.mascot.xs { width: 40px; height: 40px; } .mascot.sm { width: 52px; height: 52px; } .mascot.md { width: 84px; height: 84px; } .mascot.lg { width: 148px; height: 148px; margin: 0 auto; }
.mascot.dim { filter: grayscale(1); opacity: .5; }
.awrow { display: flex; align-items: center; gap: var(--s3); width: 100%; }
.awrow > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.awrow .mascot + .mascot { margin-left: -26px; }
.streakchip h3 { font-family: var(--font-d); }
.newaward { border-color: rgba(215,244,91,.45); background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--surface); }
.streakcard h2 { font-family: var(--font-d); }
.streakcard .macros { padding: var(--s3) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.streakcard .row.between > div { flex: 1; min-width: 0; }
.awardgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
@media (min-width: 700px) { .awardgrid { grid-template-columns: repeat(5, 1fr); } }
.award { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--s3) var(--s1); border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-align: center; min-height: 148px; transition: border-color .15s, transform .15s; }
.award:hover { border-color: var(--line-2); }
.award b { font-size: var(--text-xs); line-height: 1.25; min-height: 2.5em; display: flex; align-items: center; }
.award .mascot { width: 68px; height: 68px; }
.award.locked .mascot { filter: grayscale(1); opacity: .42; }
.award.locked b { color: var(--muted); }
.award.new { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft), 0 6px 18px rgba(215,244,91,.12); }
.awbar { display: block; width: 78%; height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.awbar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; min-width: 2px; }
.awbar.big { width: 100%; height: 8px; margin: var(--s2) 0; }
.crew { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s1); padding: var(--s2) 0; }
.crew > div { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
.crew b { font-size: var(--text-sm); } .crew span { line-height: 1.2; }
.crew .mascot { width: 100%; max-width: 60px; height: auto; aspect-ratio: 1; }
.awsheet { display: flex; flex-direction: column; gap: var(--s3); align-items: stretch; text-align: center; }
.awsheet .note.good { margin: 0; }
.prlist { list-style: none; display: flex; flex-direction: column; }
.prlist li { display: flex; align-items: center; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--line); }
.prlist li:last-child { border-bottom: 0; }
.prlist li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.prlist b { font-size: var(--text-sm); }
.prlist .mascot.xs { width: 34px; height: 34px; }
@media (prefers-reduced-motion: no-preference) {
  .award.new .mascot, .newaward .mascot { animation: awpop .7s cubic-bezier(.2, 1.4, .4, 1) both; }
  @keyframes awpop { from { transform: scale(.6) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
}

.phday { display: flex; flex-direction: column; gap: 6px; }
.phgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
@media (min-width: 700px) { .phgrid { grid-template-columns: repeat(5, 1fr); } }
.phtile { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.phtile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.phtile span { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(21,23,20,.78); color: #fff; }
.phtile.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.phfull { border-radius: var(--r); overflow: hidden; background: #000; display: grid; place-items: center; }
.phfull img { max-width: 100%; max-height: 62dvh; display: block; object-fit: contain; }
.phcmp { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.phcmp figure { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.phcmp img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r-sm); background: #000; display: block; }
.sheet-body.wide { width: min(760px, 100%); }
#privacy details.nsec:first-of-type { border-top: 0; }
.toast { width: max-content; border-radius: 20px; text-align: center; line-height: 1.35; }
.weekx { padding-top: var(--s3); border-top: 1px solid var(--line); } .weekxl { padding-bottom: 0; }
.eyebrow .ic { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }
/* Built for you: plan tuning */
#bfy { display: flex; flex-direction: column; gap: var(--s3); }
#bfy .btn.ghost { align-self: flex-start; }
.opts.compact { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.opts.compact .opt { padding: var(--s2) var(--s3); }
.exlist .exn { min-width: 0; }
.exlist .why { display: block; padding-left: 26px; font-size: var(--text-xs); color: var(--muted); margin-top: 2px; line-height: 1.35; }
.tunerow { display: flex; align-items: center; gap: var(--s2); }
.tunerow .exlink { flex: 1; min-width: 0; }
.prefrow { margin: var(--s2) 0 var(--s3); }
.prefrow .btn.on .ic { fill: currentColor; }
@media (max-width: 380px) { .opts.compact { grid-template-columns: 1fr; } }
/* Tailoring extras: supersets, finishers, ratings, saved gyms, rankings */
.pill.accent { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.stdtop { display: flex; flex-direction: column; gap: 4px; padding-bottom: var(--s3); margin-bottom: var(--s2); border-bottom: 1px solid var(--line); }
.stdtop .big { font-size: var(--text-xl, 1.6rem); color: var(--accent); line-height: 1.1; }
.std .row.gap { gap: 6px; }
.excard.ss { border-left: 3px solid var(--accent); }
.excard.ss1 { margin-bottom: 4px; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; }
.excard.ss2 { border-top-left-radius: 6px; border-top-right-radius: 6px; }
.sstag { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--accent); margin: 0 0 var(--s2); }
.sstag .ic { width: 14px; height: 14px; flex: none; }
.ssb { color: var(--accent); font-size: var(--text-xs); font-weight: 700; margin-right: 2px; }
.sessopts { margin: var(--s2) 0; }
.finli .exn { color: var(--accent); }
.fincard { border: 1px dashed rgba(215,244,91,.45); }
.fintimer { display: flex; align-items: baseline; gap: var(--s3); padding: var(--s3); border-radius: var(--r-sm); background: var(--accent-soft); margin: var(--s2) 0; }
.fintimer b { font-size: 2rem; color: var(--accent); }
.fintimer span { font-size: var(--text-sm); color: var(--text); }
.fintimer.easy { background: var(--surface-2); } .fintimer.easy b { color: var(--muted); }
.ratebox { text-align: left; margin: var(--s3) 0; display: flex; flex-direction: column; gap: var(--s2); }
.raterow { display: flex; flex-direction: column; gap: 6px; padding: var(--s2) 0; border-top: 1px solid var(--line); }
.raterow > span { font-size: var(--text-sm); font-weight: 600; }
.ratebtns button { min-height: 38px; font-size: var(--text-xs); }
.ratebtns button.on { color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ratepage { margin-bottom: var(--s3); }
.ratepage .raterow { border-top: 0; padding-top: 0; }
.addplace { display: inline-flex; align-items: center; gap: 4px; padding: 0 12px; min-height: 36px; border-radius: 999px; border: 1px dashed var(--line-2); color: var(--muted); font-size: var(--text-xs); white-space: nowrap; }
.addplace .ic { width: 14px; height: 14px; }
.linkbtn { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font: inherit; padding: 0; }
#placesheet input { width: 100%; }
.modes .addplace { border-style: dashed; color: var(--muted); background: transparent; }

/* ---------- light theme (html[data-theme=light]); dark stays the default ---------- */
:root { --bm-base: #2a2f38; --bm-off: #3b4352; --bm-gap: var(--surface); --bm-line: rgba(255,255,255,.06); --tabbar-bg: rgba(21,23,20,.92); --hover: #262b35; --zone: rgba(255,255,255,.09);
  --note-ink: #f6d395; --warn-ink: #f6b597; --info-ink: #c4dcfa; --miss-ink: #f8ab95; --wheel-fade: rgba(21,23,20,0); --tip-bg: #0b0c0f; }
html[data-theme=light] {
  --bg: #f4f3ef; --surface: #ffffff; --surface-2: #f0eee9; --line: #e4e1da; --line-2: #d2cec5;
  --text: #16181c; --muted: #5d6169; --faint: #8a8d94;
  --accent: #5E7010; --accent-ink: #151714; --accent-soft: rgba(94,112,16,.13);
  --good: #17864c; --good-soft: rgba(23,134,76,.11); --warn: #c4511d; --warn-soft: rgba(196,81,29,.11);
  --p: #2a72c9; --c: #5E7010; --f: #8e4fbf;
  --plan: #5E7010; --plan-soft: rgba(94,112,16,.13); --miss: #c4461f; --miss-soft: rgba(196,70,31,.11); --info: #2a72c9; --info-soft: rgba(42,114,201,.10);
  --bm-base: #d9d6cf; --bm-off: #bfc4cc; --bm-gap: var(--surface); --bm-line: rgba(0,0,0,.05); --tabbar-bg: rgba(255,255,255,.9); --hover: #e9e7e1; --zone: rgba(0,0,0,.06);
  --note-ink: #6e4a00; --warn-ink: #9a3a12; --info-ink: #1d4f8c; --miss-ink: #9c3416; --wheel-fade: rgba(244,243,239,0); --tip-bg: #ffffff;
  color-scheme: light;
}
html[data-theme=light] body { background: var(--bg); }
html[data-theme=light] .btn.primary { background: #D7F45B; color: #151714; }
html[data-theme=light] .btn.primary:hover { background: #e8a52a; }
html[data-theme=light] .card, html[data-theme=light] .excard { box-shadow: 0 1px 2px rgba(20,20,20,.04); }
html[data-theme=light] .sheet-bg { background: rgba(20,22,26,.35); }
html[data-theme=light] .mz.s-hit2 { fill: rgba(94,112,16,.38); }
html[data-theme=light] .modes button.on { background: var(--text); color: var(--surface); }
.themeseg { margin-top: var(--s2); }
html[data-theme=light] .mz.s-ok, html[data-theme=light] .legend i.s-ok { fill: #34a96a; background: #34a96a; }
html[data-theme=light] .mz.s-mid, html[data-theme=light] .mz.s-hit, html[data-theme=light] .legend i.s-mid, html[data-theme=light] .legend i.s-hit { fill: #9DB82A; background: #9DB82A; }
html[data-theme=light] .mz.s-low, html[data-theme=light] .legend i.s-low { fill: #e2683a; background: #e2683a; }

/* ---------- body measurements (tiles around a figure) ---------- */
:root { --ms-fig-a: #8f97d6; --ms-fig-b: #5d64a8; --ms-ln: rgba(255,255,255,.16); }
html[data-theme=light] { --ms-fig-a: #b8bdf0; --ms-fig-b: #8e95dc; --ms-ln: rgba(255,255,255,.55); }
.mlayout { display: grid; grid-template-columns: 1fr minmax(92px, 1fr) 1fr; gap: var(--s2); align-items: stretch; }
.mcol { display: flex; flex-direction: column; gap: var(--s2); }
.mfig { display: flex; align-items: center; justify-content: center; padding: var(--s2) 0; }
.mfig svg { width: 100%; max-width: 170px; height: auto; filter: drop-shadow(0 6px 14px rgba(70,80,170,.25)); }
.ms-ln { fill: none; stroke: var(--ms-ln); stroke-width: 1.3; stroke-linecap: round; }
.mcustom { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.mtile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 64px; padding: var(--s2) var(--s3); text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); transition: border-color .15s, transform .08s; }
.mtile:hover { border-color: var(--accent); }
.mtile:active { transform: scale(.98); }
.mtile span { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mtile b { font-family: var(--font-d); font-size: var(--text-lg); font-weight: 800; line-height: 1.1; }
.mtile b em { font-style: normal; font-family: var(--font-b); font-size: var(--text-xs); font-weight: 500; color: var(--muted); margin-left: 3px; }
.mtile.empty b { color: var(--faint); }
.mtile i { position: absolute; top: var(--s2); right: var(--s2); font-style: normal; font-size: 10px; font-weight: 700; color: var(--faint); }
.mnames { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s2); padding-top: var(--s2); }
.mnames input { width: 100%; min-height: 40px; padding: 0 var(--s3); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.whr { align-items: center; text-align: center; }
.whr-v { font-family: var(--font-d); font-size: 2.2rem; font-weight: 800; line-height: 1; color: var(--p); }
.whr-v.mid { color: var(--good); } .whr-v.high { color: var(--warn); }
.whr-bar { position: relative; display: flex; width: 100%; height: 8px; border-radius: 99px; margin-top: 28px; }
.whr-bar span { height: 100%; } .whr-bar .z1 { background: var(--p); border-radius: 99px 0 0 99px; } .whr-bar .z2 { background: var(--good); } .whr-bar .z3 { flex: 1; background: var(--c); border-radius: 0 99px 99px 0; }
.whr-bar i { position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--p); transform: translate(-50%, -50%); }
.whr-ticks { position: relative; width: 100%; height: 0; } .whr-ticks span { position: absolute; top: -40px; transform: translateX(-50%); font-size: var(--text-xs); color: var(--muted); }
.whr-lab { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; font-size: var(--text-xs); color: var(--muted); }
.whr p.small { text-align: left; }
@media (max-width: 360px) { .mtile { padding: 6px 8px; } .mtile b { font-size: var(--text-base); } }

/* supplements in nutrient totals */
.bar.hassup { display: flex; } .bar.hassup i { border-radius: 0; } .bar.hassup i:first-child { border-radius: 6px 0 0 6px; } .bar.hassup i:last-child { border-radius: 0 6px 6px 0; } .bar.hassup i:only-child { border-radius: 6px; }
.bar.hassup { --sc: var(--accent); } .bar.hassup.n-ok { --sc: var(--good); } .bar.hassup.n-hi { --sc: var(--warn); }
.bar.hassup i.sp { background: repeating-linear-gradient(135deg, var(--sc) 0 3px, color-mix(in srgb, var(--sc) 45%, transparent) 3px 6px); }
.legend i.s-sup { background: repeating-linear-gradient(135deg, var(--muted) 0 3px, color-mix(in srgb, var(--muted) 40%, transparent) 3px 6px); }
.suppin { margin-bottom: var(--s1); }
.ingrows { display: flex; flex-direction: column; gap: var(--s2); }
.ingrow { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(56px, 1fr) minmax(64px, .9fr) 36px; gap: var(--s2); align-items: center; }
.ingrow select, .ingrow input { width: 100%; min-height: 40px; }
.ingrow .ingname { grid-column: 1 / -1; }
.ingrow .iconbtn { width: 36px; height: 36px; }
.ingprev { display: flex; flex-direction: column; gap: 4px; }
.ingprev li { display: flex; justify-content: space-between; gap: var(--s2); font-size: var(--text-xs); list-style: none; }
.ingprev li b { font-weight: 600; } .ingprev li .hi { color: var(--warn); }
.ingline { font-size: var(--text-xs); color: var(--muted); }
.suppadds { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- active workout, minimised bar, rest timer (v14) ---------- */
.view.withbar { padding-bottom: calc(var(--tab-h) + 72px + var(--s8) + env(safe-area-inset-bottom)); }
.abar { position: fixed; left: 0; right: 0; margin: 0 auto; max-width: 544px; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 6px); z-index: 11; width: calc(100% - 16px); display: flex; align-items: stretch; gap: 4px; background: var(--surface-2); border: 1px solid var(--accent); border-radius: 14px; padding: 4px 4px 7px; box-shadow: 0 8px 24px rgba(0,0,0,.28); overflow: hidden; }
.abar-main { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 6px 8px; text-align: left; border-radius: 10px; min-height: 48px; }
.abar-t { display: flex; flex-direction: column; min-width: 0; }
.abar-t b, .abar-t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.abar-t b { font-size: var(--text-sm); } .abar-t span { color: var(--muted); }
.abar-r { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.abar-r b { color: var(--accent); font-family: var(--font-d); font-weight: 800; }
.abar-r span { color: var(--muted); min-height: 1em; }
.abar.paused .abar-r b { color: var(--muted); }
.abar-end { align-self: center; flex: none; }
.abar-p { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line); }
.abar-p i { display: block; height: 100%; background: var(--accent); }
.wtop { align-items: center; }
.wtitle { min-width: 0; }
.wname { display: inline-flex; align-items: center; gap: 6px; font: inherit; color: inherit; text-align: left; max-width: 100%; }
.wname svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.wstat { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.wstat b { font-family: var(--font-d); font-size: var(--text-lg); font-weight: 800; }
.wprog { display: flex; flex-direction: column; gap: 6px; }
.pbar.thin { height: 6px; }
.expnav { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.exdots { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; flex: 1; min-width: 0; }
.exdot { width: 22px; height: 28px; position: relative; flex: none; }
.exdot::after { content: ''; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--line-2); }
.exdot.done::after { background: var(--good); } .exdot.skip::after { background: var(--faint); opacity: .5; }
.exdot.on::after { background: var(--accent); width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; }
.swipehint { margin-top: calc(-1 * var(--s1)); }
.setrow.cur { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--accent-soft); }
.csbtn { margin-top: var(--s1); }
.calc { color: var(--text); margin: 0; }
.dbmode { max-width: 320px; }
.muscles { margin: 0; } .muscles b { font-weight: 600; }
.lastperf { margin: 0; }
.excard.skipped { opacity: .62; }
.exfoot .btn svg { width: 16px; height: 16px; }
.cuebox .cuefig.figs { max-width: 440px; gap: var(--s3); }
.cuebox .cuefig.figs.one { grid-template-columns: minmax(0, 240px); justify-content: center; }
.cuebox .cuefig .figbox { padding: var(--s2); }
.cuebox .cuefig .figbox svg { width: 100%; height: auto; }
.cuebox .cues { margin: 0; }
.rest { padding: var(--s3); display: flex; flex-direction: column; gap: var(--s3); border-radius: 18px; }
.rest-top { display: flex; align-items: center; gap: var(--s3); }
.rest .rest-ring { position: relative; width: 112px; height: 112px; flex: none; display: block; }
.rest .rest-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.rest .trk { fill: none; stroke: var(--line); stroke-width: 8; }
.rest .arc { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 326.7; transition: stroke-dashoffset .25s linear; }
.rest-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rest-c b { font-family: var(--font-d); font-size: 2rem; font-weight: 800; color: var(--accent); line-height: 1; }
.rest-c span { color: var(--muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.rest-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--s2); }
.rest-side p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rest-pre { display: flex; flex-wrap: wrap; gap: 4px; }
.rest-pre .chip { min-height: 32px; padding: 0 9px; font-size: var(--text-xs); }
.rest-ctl { justify-content: space-between; flex-wrap: nowrap; }
.rest-ctl .btn { flex: 1; padding: 0 6px; min-width: 0; }
.rest-ctl .btn svg { width: 15px; height: 15px; }
.workout .wfoot { margin-bottom: 220px; }
/* summary */
.summary .sumbtns { display: flex; flex-direction: column; gap: var(--s2); width: 100%; }
.macros.four { grid-template-columns: repeat(4, 1fr); }
.macros.four b { font-size: var(--text-lg); }
.cmp { width: 100%; }
.avinline { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.avinline p { margin: 0; text-align: center; }
/* history editor */
.heex { gap: var(--s2); display: flex; flex-direction: column; }
.hemeta select, .hemeta input { height: 36px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; color: var(--text); padding: 0 6px; }
.hemeta input { width: 72px; }
.inl { display: inline-flex; align-items: center; gap: 6px; }
.herow { display: grid; grid-template-columns: 1fr 1fr 12px 1fr 40px; gap: 6px; align-items: center; margin-top: 6px; }
.herow.head { margin-top: 0; }
.herow select, .herow input { height: 42px; min-width: 0; width: 100%; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; color: var(--text); padding: 0 8px; font-variant-numeric: tabular-nums; }
.hecalc { margin: 2px 0 0; min-height: 0; }
.hecalc:empty { display: none; }
#histedit .sticky { position: sticky; bottom: calc(-1 * var(--s4)); background: var(--surface); padding: var(--s3) 0; }
/* settings rows */
.optrow { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s2) 0; cursor: pointer; border-top: 1px solid var(--line); }
.optrow:first-of-type { border-top: 0; }
.optrow input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin-top: 1px; }
.optrow .grow { display: flex; flex-direction: column; gap: 2px; }
.optrow b { font-size: var(--text-sm); }
.sessname { align-items: center; } .sessname h2 { margin: 0; }
.gymline { display: flex; align-items: center; gap: 6px; margin: 0; flex-wrap: wrap; }
.gymline svg { width: 15px; height: 15px; }
.gymavail { margin-top: var(--s3); }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; align-items: center; }
.chips.scroll .chip { flex: none; }
/* Moku */
.avatar { width: 72px; height: 72px; flex: none; display: block; overflow: visible; }
.avatar.sm { width: 56px; height: 56px; } .avatar.md { width: 88px; height: 88px; } .avatar.xl { width: 150px; height: 150px; margin: 0 auto; }
.avcard .awrow { align-items: center; }
.avcard .eyebrow { margin: 0 0 2px; }
.avcard p.small { margin: 0; }
.avsheet h2 { margin-bottom: 0; }
.avstages { list-style: none; padding: 0; margin: var(--s3) 0; display: flex; flex-direction: column; gap: 6px; text-align: left; width: 100%; }
.avstages li { display: flex; flex-direction: column; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); opacity: .6; }
.avstages li.on { opacity: 1; } .avstages li.cur { border-color: var(--accent); background: var(--accent-soft); }
.av-b { transform-box: fill-box; transform-origin: 50% 100%; animation: av-breathe 4.2s ease-in-out infinite; }
.av-leaf { transform-box: fill-box; transform-origin: 50% 100%; animation: av-sway 5s ease-in-out infinite; }
.av-sleepy .av-b { animation-duration: 6s; }
.av-z { animation: av-z 3s ease-in-out infinite; }
.av-glow { animation: av-glow 4s ease-in-out infinite; }
.av-spark { animation: av-glow 2.6s ease-in-out infinite; }
@keyframes av-breathe { 50% { transform: scale(1.025, 1.04); } }
@keyframes av-sway { 50% { transform: rotate(4deg); } }
@keyframes av-z { 50% { transform: translateY(-3px); opacity: .55; } }
@keyframes av-glow { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .av-b, .av-leaf, .av-z, .av-glow, .av-spark { animation: none; } }
html[data-theme=light] .abar { box-shadow: 0 6px 18px rgba(20,20,20,.12); }
.avatar { color: var(--muted); }

/* ---------- custom workouts, focus day, PR celebration ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.altday { align-items: center; margin-top: var(--s3); padding-top: var(--s3); border-top: 1px dashed var(--line); }
.altday > span { flex: 1 1 100%; }
@media (min-width: 560px) { .altday > span { flex: 0 1 auto; margin-right: auto; } }
.cwcard h3 { font-size: var(--text-lg); }
.cwlist { list-style: none; padding: 0; margin: var(--s2) 0 var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.cwrow { border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s3); background: var(--bg); display: flex; flex-direction: column; gap: var(--s2); }
.cwname { display: flex; flex-direction: column; min-width: 0; }
.cwname b { overflow-wrap: anywhere; }
.cwctl { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.cwctl select { width: auto; flex: 1 1 120px; padding: 8px 10px; font-size: var(--text-sm); }
.cwstep { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-2); border-radius: 999px; padding: 2px; }
.cwstep .num { min-width: 52px; text-align: center; font-size: var(--text-sm); font-weight: 700; }
.cwstep .iconbtn, .cwmove .iconbtn { font-size: 18px; font-weight: 700; }
.cwmove { display: inline-flex; gap: 4px; margin-left: auto; }
.iconbtn:disabled { opacity: .35; }
.lib.ex.picked { border-color: var(--accent); background: var(--accent-soft); }
.lib.ex.picked h3::after { content: ' \2713'; color: var(--accent); }
.fchips .chip { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; }
.fdot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--bm-off); }
.fdot.s-ok { background: var(--good); } .fdot.s-mid { background: var(--accent); } .fdot.s-low { background: var(--warn); }
.fwhy { display: block; font-size: var(--text-xs); line-height: 1.3; margin-top: 2px; }
.prpop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--s4); opacity: 0; transition: opacity .2s; }
.prpop.show { opacity: 1; }
.prpop-bg { position: absolute; inset: 0; background: rgba(8, 10, 14, .6); }
.prpop-card { position: relative; width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line-2); border-radius: 22px; padding: var(--s5) var(--s4) var(--s4); text-align: center; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35); transform: scale(.9); transition: transform .35s cubic-bezier(.2,1.4,.4,1); }
.prpop.show .prpop-card { transform: none; }
.prpop-card h2 { margin: 2px 0 4px; overflow-wrap: anywhere; }
.prpop-card .eyebrow { color: #c9891a; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
html[data-theme=light] .prpop-card .eyebrow { color: #9a6410; }
.prpop-card .eyebrow .ic { width: 16px; height: 16px; }
.prset { font-size: var(--text-xl); font-weight: 800; margin: 0 0 2px; }
.prpop-card .btn { margin-top: var(--s3); }
.prstage { position: relative; height: 150px; display: flex; align-items: flex-end; justify-content: center; gap: 0; margin-bottom: var(--s2); }
.prstage .prmoku { width: 120px; height: 140px; animation: prhop 1.1s ease-in-out infinite; }
.prtrophy { width: 72px; height: 72px; margin-left: -18px; margin-bottom: 8px; filter: drop-shadow(0 4px 10px rgba(215,244,91,.45)); animation: prshine 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
.prconf { position: absolute; inset: 0; pointer-events: none; }
.prconf i { position: absolute; top: -12px; left: var(--x); width: 7px; height: 11px; border-radius: 2px; background: var(--c); transform: rotate(var(--r)); animation: prfall var(--d) linear var(--w) infinite; opacity: .9; }
@keyframes prfall { to { transform: translateY(460px) rotate(calc(var(--r) + 540deg)); } }
@keyframes prhop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px); } }
@keyframes prshine { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .prconf { display: none; } .prstage .prmoku, .prtrophy { animation: none; } .prpop, .prpop-card { transition: none; } }

/* light/dark switch in every tab header */
.top .topl { min-width: 0; }
.topr { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; align-self: flex-start; flex: none; }
.top .themebtn { align-self: flex-end; width: 38px; height: 38px; border: 1px solid var(--line-2); border-radius: 50%; color: var(--muted); }
.top .themebtn .ic { width: 18px; height: 18px; }
.top .themebtn:hover { color: var(--text); border-color: var(--muted); }
