:root {
  /* TorchRep brand colors, sampled from the logo sheet. */
  --bg:#160219; --card:#27042c; --line:#47174f; --text:#f8f2f9; --muted:#bfaec4; --ok:#3ecf8e;
  --accent:#fe9702; /* orange, for text and icons on dark backgrounds */
  --accent-fill:#cf0a24; /* red, for solid fills behind white text */
  --flame:linear-gradient(100deg,#cf0a24,#d23a04); /* buttons, dark enough for white text */
  --danger:#ff7b7b; --bad-text:#ff8a98; --dot:#cfcfcf; --swatch-empty:#3a3f4b;
  --warn:#ffc04d; /* status: needs attention (always shown with an icon and a label) */
  /* body map: one orange from pale to deep in five steps; a picked muscle pulses */
  --heat-1:#ffe0b8; --heat-2:#ffbe73; --heat-3:#ff962e; --heat-4:#f06a0c; --heat-5:#c9410a; --heat-sel:#ff3d6e;
  color-scheme:dark; /* native controls, such as dropdowns and scrollbars */
}
:root[data-theme="light"] {
  --bg:#faf6fb; --card:#ffffff; --line:#e3d7e7; --text:#27042c; --muted:#6a5571; --accent:#b23604;
  --danger:#c00e26; --bad-text:#a30a1f; --dot:#8d7b93; --swatch-empty:#d9cfdd;
  --warn:#8a5300;
  color-scheme:light;
}
:root[data-theme="light"] .on-dark, :root:not([data-theme="light"]) .on-light { display:none; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin:0; min-height:100vh; background:var(--bg); color:var(--text);
  font:16px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif;
  padding:max(16px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom)); }
button { font:inherit; color:inherit; cursor:pointer; }
input, select, textarea { font:inherit; font-size:16px; /* 16px stops iOS zoom-on-focus */ color:var(--text); }
[hidden] { display:none !important; }

/* auth */
body > .card { width:100%; max-width:420px; margin:6vh auto 0; background:var(--card); border:1px solid var(--line); border-radius:16px; padding:28px; }
.logo { margin:0; font-size:26px; letter-spacing:-.5px; }
body > .card .logo { text-align:center; margin-bottom:20px; font-size:28px; }
.logo { display:flex; flex-direction:column; align-items:center; gap:10px; }
.logo-mascot { width:128px; height:auto; }
.logo-word { width:210px; height:auto; }
.brand-bar { display:flex; align-items:center; gap:8px; }
.brand-bar img { display:block; width:auto; height:38px; }
.brand-bar img + img { height:34px; }
.tabs { display:flex; gap:4px; background:var(--bg); border-radius:10px; padding:4px; margin-bottom:20px; }
.tabs button { flex:1; background:none; border:0; color:var(--muted); padding:10px; border-radius:7px; }
.tabs button.active { background:var(--line); color:var(--text); }
form { display:grid; gap:14px; }
.row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
label { display:grid; gap:6px; font-size:14px; color:var(--muted); }
input, select { padding:12px; border-radius:10px; border:1px solid var(--line); background:var(--bg); width:100%; min-height:44px; }
input:focus, select:focus { outline:2px solid var(--accent); outline-offset:-1px; }
small { font-size:12px; }
.primary { padding:12px; border-radius:10px; border:0; font-weight:600; background:var(--flame); color:#fff; min-height:44px; }
.primary:disabled { opacity:.6; }
.error { color:var(--danger); margin:0; min-height:1.2em; font-size:14px; }
.auth-title { margin:0; font-size:20px; }
.auth-intro { margin:-6px 0 0; font-size:14px; color:var(--muted); }
.auth-notice { margin:0; padding:12px; border-radius:10px; border:1px solid var(--line); background:var(--bg); font-size:14px; }
.muted { color:var(--muted); }

/* app shell */
#app { max-width:560px; margin:0 auto; padding-bottom:104px; } /* room for the floating tab bar */
.topbar { display:flex; align-items:center; gap:8px; margin-bottom:16px; min-height:44px; }
.topbar .title { flex:1; font-size:20px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.icon-btn { background:var(--card); border:1px solid var(--line); border-radius:10px; min-width:44px; min-height:44px; padding:0 12px; }
.icon-btn.danger { color:var(--danger); }
.icon-btn.on { background:var(--flame); border-color:var(--accent-fill); color:#fff; }
h2.section { font-size:13px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); margin:24px 0 8px; font-weight:600; }
.list { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; } /* long names shorten with … instead of widening the list */
.item { display:flex; align-items:center; gap:4px; background:var(--card); border:1px solid var(--line); border-radius:12px; padding:14px; min-height:56px; }
.item-main { flex:1; min-width:0; display:flex; align-items:center; gap:12px; background:none; border:0; color:inherit; font:inherit; text-align:left; padding:0; }
.item .emoji { font-size:22px; }
.item .name { flex:1; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.item .meta { color:var(--muted); font-size:13px; }
.grip { flex:none; color:var(--muted); font-size:20px; line-height:1; padding:8px 4px; cursor:grab; touch-action:none; user-select:none; -webkit-user-select:none; }
.item.dragging { position:relative; z-index:5; cursor:grabbing; border-color:var(--accent); box-shadow:0 10px 26px rgba(0,0,0,.55); pointer-events:none; }
.item.dragging .grip { cursor:grabbing; }
.item.drop-into { outline:2px solid var(--accent); outline-offset:-2px; background:rgba(254,104,2,.18); }

/* color swatch (left of each item) */
.swatch { flex:none; width:24px; height:24px; background:var(--swatch-empty); display:inline-block; cursor:pointer; }
.swatch.exercise { border-radius:50%; }
.swatch.folder { border-radius:7px; }
.swatch:active { transform:scale(.9); }

/* move-out drop strip (folder screens, visible only while dragging) */
.dropout { display:none; text-align:center; color:var(--muted); border:1px dashed var(--line); border-radius:12px;
  padding:14px; margin-bottom:12px; font-weight:600; }
body.dragging-active .dropout { display:block; }
.dropout.drop-active { border-color:var(--accent); border-style:solid; color:var(--accent); background:rgba(254,104,2,.18); }
.empty { color:var(--muted); padding:16px; text-align:center; border:1px dashed var(--line); border-radius:12px; }
.actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:20px; }
.actions .ghost, .ghost { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:12px; min-height:44px; font-weight:600; }

/* exercise screen */
.hdr { margin:4px 0 16px; }
.eyebrow { font-size:13px; letter-spacing:.14em; text-transform:uppercase; color:var(--muted); }
.hdr h1 { margin:2px 0; font-size:32px; line-height:1.15; letter-spacing:-.5px; }
.hdr .sub { color:var(--muted); }
.panel { background:var(--card); border:1px solid var(--line); border-radius:20px; padding:20px; margin-bottom:14px; }
.panel.details { display:grid; gap:12px; }
/* exercise settings, full screen */
.exd-screen { position:fixed; inset:0; z-index:60; display:flex; flex-direction:column; height:100dvh; background:var(--bg); padding-top:env(safe-area-inset-top); }
.exd-screen[hidden] { display:none; }
.exd-top { flex:none; display:flex; align-items:center; gap:12px; width:100%; max-width:560px; margin:0 auto; padding:12px 16px; }
.exd-top h2 { flex:1; margin:0; font-size:22px; }
.exd-done { min-width:88px; }
.exd-scroll { flex:1; min-height:0; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:0 16px max(24px, env(safe-area-inset-bottom)); }
.exd-scroll > .panel { max-width:560px; margin:0 auto; }
body:has(.exd-screen:not([hidden])) { overflow:hidden; }
body:has(.exd-screen:not([hidden])) #tabbar { display:none; }
.link { background:none; border:0; color:var(--accent); font-weight:600; padding:8px 0; min-height:36px; }
.link.center { display:block; margin:6px auto 0; color:var(--muted); font-weight:400; }

.panel.cal { padding:14px 16px; }
.cal-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.cal-head strong { font-size:16px; }
.cal-head .icon-btn { background:transparent; font-size:18px; min-height:36px; min-width:36px; }
.week-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; touch-action:pan-y; }
.wday { display:flex; flex-direction:column; align-items:center; gap:5px; background:none; border:0; border-radius:12px; padding:8px 0 7px; color:var(--text); }
.wday .wdow { font-size:12px; color:var(--muted); }
.wday .wnum { width:38px; height:38px; display:grid; place-items:center; border-radius:50%; font-size:17px; font-weight:600; }
.wday.today .wnum { color:var(--accent); }
.wday.sel .wnum { background:var(--flame); color:#fff; }
.wdot { width:4px; height:4px; border-radius:50%; background:transparent; }
.wdot.on { background:var(--dot); }
.wday.sel .wdot.on { background:var(--accent); }
/* month calendar: the same height as the week strip it replaced, whether the month spans 5 or 6 weeks */
.month-grid { gap:0; height:100px; grid-template-rows:12px repeat(var(--weeks),1fr); }
.cal:has(.month-grid) .cal-head { margin-bottom:2px; }
.cal:has(.month-grid) .cal-head .icon-btn { min-height:28px; min-width:32px; }
.cal:has(.month-grid) .cal-foot { margin-top:4px; }
.mdow { display:grid; place-items:center; font-size:11px; color:var(--muted); }
.mday { display:grid; place-items:center; min-height:0; padding:0; background:none; border:0; color:var(--text); font-size:12px; font-variant-numeric:tabular-nums; }
.mday span { display:grid; place-items:center; height:min(22px, 100%); aspect-ratio:1; border-radius:50%; }
.mday.out { color:var(--muted); opacity:.55; }
.mday.on span { background:color-mix(in srgb, var(--dot) 30%, transparent); font-weight:700; }
.mday.today span { color:var(--accent); font-weight:700; }
.mday.sel span { background:var(--flame); color:#fff; font-weight:700; }
.cal-foot { display:flex; justify-content:space-between; align-items:center; color:var(--muted); font-size:13px; margin-top:8px; }
.dot { display:inline-block; width:12px; height:12px; border-radius:50%; background:var(--dot); margin-right:4px; vertical-align:-1px; }

.day-title { margin:0 0 14px; font-size:20px; }
.log-row { display:flex; gap:10px; align-items:flex-end; }
.log-row .fld { flex:1; min-width:0; }
.fld .lbl { color:var(--muted); margin-bottom:6px; }
.unit-btn { background:none; border:0; padding:0 2px; color:var(--accent); font:inherit; text-decoration:underline; text-underline-offset:3px; }
input.big { font-size:26px; font-weight:700; padding:14px; min-height:64px; border-radius:14px; background:transparent; width:100%; }
input.big::placeholder { color:var(--text); opacity:.35; font-weight:700; }
.save-btn { flex:none; width:64px; height:64px; border-radius:14px; border:0; background:var(--flame); color:#fff; display:flex; align-items:center; justify-content:center; }
.save-btn:active { opacity:.85; }
.x { background:none; border:0; color:var(--muted); font-size:24px; min-width:44px; min-height:48px; }

.notes-head { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:12px; }
.notes-head h2 { margin:0; font-size:20px; }
.notes-box { border:1px solid var(--line); border-radius:14px; padding:14px; }
.notes-box textarea { display:block; width:100%; margin-top:10px; background:transparent; border:0; color:var(--text); font:inherit; font-size:16px; resize:vertical; min-height:120px; padding:0; }
.notes-box textarea:focus { outline:none; }
.notes-box:focus-within { border-color:var(--accent); }

/* dialog */
dialog { border:1px solid var(--line); border-radius:16px; background:var(--card); color:var(--text); width:min(92vw,380px); padding:20px; }
dialog::backdrop { background:rgba(0,0,0,.6); }
dialog h3 { margin:0 0 12px; }
.dlg-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.dlg-actions button:not(.primary) { background:var(--bg); border:1px solid var(--line); border-radius:10px; min-height:44px; }

/* bottom tab bar: a floating glass pill; a highlight slides under the open tab (--tab is its index) */
#tabbar { position:fixed; z-index:50; left:50%; bottom:max(10px, env(safe-area-inset-bottom)); width:min(520px, calc(100% - 20px)); translate:-50% 0;
  display:flex; padding:6px; border-radius:26px; border:1px solid color-mix(in srgb, var(--line) 85%, transparent);
  background:color-mix(in srgb, var(--card) 78%, transparent); backdrop-filter:blur(18px) saturate(1.5); -webkit-backdrop-filter:blur(18px) saturate(1.5);
  box-shadow:0 12px 34px rgba(0,0,0,.4), 0 1px 0 color-mix(in srgb, #fff 6%, transparent) inset; }
#tabbar::before { content:""; position:absolute; top:6px; bottom:6px; left:6px; width:calc((100% - 12px) / 5); border-radius:20px;
  background:color-mix(in srgb, var(--accent-fill) 22%, transparent); box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
  transform:translateX(calc(var(--tab, 0) * 100%)); transition:transform 420ms var(--ease-spring); }
#tabbar button { position:relative; flex:1; min-width:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  min-height:54px; padding:6px 1px; border:0; border-radius:20px; background:none; color:var(--muted); font-size:clamp(10px, 3vw, 11px); font-weight:600; }
#tabbar button svg { width:23px; height:23px; transition:transform var(--dur) var(--ease); }
#tabbar button span { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#tabbar button.active { color:var(--accent); }
#tabbar button.active svg { transform:translateY(-1px); stroke-width:2.3; }
#tabbar button:active svg { transform:scale(.9); }
:root[data-theme="light"] #tabbar { box-shadow:0 10px 30px rgba(39,4,44,.14); }

/* progress screen */
.stats { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:14px; }
.stat { background:var(--card); border:1px solid var(--line); border-radius:16px; padding:16px; }
.stat .n { font-size:30px; font-weight:700; line-height:1.1; }
.stat .l { color:var(--muted); font-size:13px; margin-top:4px; }
.act { display:flex; align-items:center; gap:12px; background:var(--card); border:1px solid var(--line);
  border-radius:12px; padding:14px; margin-bottom:8px; }
.act .name { flex:1; font-weight:600; }
.act .meta { color:var(--muted); font-size:13px; text-align:right; }

/* profile screen */
.avatar { width:72px; height:72px; border-radius:50%; background:var(--flame); color:#fff;
  display:grid; place-items:center; font-size:28px; font-weight:700; margin:8px auto 12px; }
.prof-card { background:var(--card); border:1px solid var(--line); border-radius:16px; padding:4px 16px; }
.prof-row { display:flex; justify-content:space-between; gap:12px; padding:14px 0; border-bottom:1px solid var(--line); }
.prof-row:last-child { border-bottom:0; }
.prof-row .k { color:var(--muted); }
.prof-row .v { font-weight:600; text-align:right; word-break:break-word; }

/* stats and charts */
:root { --viz-1:#d97800; --viz-2:#1fa596; --viz-3:#977ae8; --viz-on:#160219; }
:root[data-theme="light"] { --viz-1:#b23604; --viz-2:#0f8f80; --viz-3:#6a4fd0; --viz-on:#ffffff; }
.range-picker { margin-bottom:14px; }
.range-picker button { padding:10px 4px; white-space:nowrap; }
#stats-body { transition:opacity var(--dur) var(--ease); }
#stats-body.refreshing:not(:has(.skel)) { opacity:.5; }
.stats-link { flex:none; display:grid; place-items:center; width:40px; height:40px; background:none; border:0; border-radius:10px; color:var(--muted); }
.macro-bar { flex-basis:100%; display:flex; gap:2px; height:8px; }
.macro-bar i { flex:0 1 0; min-width:0; border-radius:4px; transition:flex-grow var(--dur-slow) var(--ease); }
.key { display:inline-block; width:8px; height:8px; border-radius:2px; margin-right:4px; vertical-align:1px; }
@media (max-width:360px) { .topbar { gap:4px; } .topbar .icon-btn { min-width:38px; padding:0 8px; } }
.report-card { padding:16px; }
.chart-head { margin-bottom:14px; }
.chart-head h3 { margin:0; font-size:16px; }
.chart { position:relative; margin:0; border-radius:8px; }
.plot { position:relative; height:140px; margin:6px 0 0 40px; touch-action:pan-y; }
.tick { position:absolute; left:0; right:0; border-top:1px solid var(--line); }
.tick span { position:absolute; right:100%; margin-right:6px; transform:translateY(-50%); font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
.slots { position:absolute; inset:0; display:flex; gap:2px; }
.slot { position:relative; flex:1 1 0; min-width:0; height:100%; display:flex; align-items:flex-end; justify-content:center; }
.bar { display:block; width:100%; max-width:24px; min-height:2px; border-radius:4px 4px 0 0; background:var(--viz-1); }
.slot.on .bar { filter:brightness(1.25); }
.ref-line { position:absolute; left:0; right:0; border-top:1px solid var(--text); opacity:.6; pointer-events:none; }
.line { position:absolute; inset:0; width:100%; height:100%; overflow:visible; pointer-events:none; }
.line polyline { fill:none; stroke:var(--viz-1); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; vector-effect:non-scaling-stroke; }
.slot.point { position:absolute; top:0; width:0; flex:none; }
.slot.point.on::before { content:""; position:absolute; top:0; bottom:0; left:0; border-left:1px solid var(--muted); }
.line-dot { position:absolute; left:-4px; width:8px; height:8px; margin-bottom:-4px; border-radius:50%; background:var(--viz-1); box-shadow:0 0 0 2px var(--card); }
.slot.on .line-dot { box-shadow:0 0 0 2px var(--card), 0 0 0 3px var(--viz-1); }
.x-axis { display:flex; justify-content:space-between; gap:8px; margin:6px 0 0 40px; font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; }
.x-axis.under-slots { display:grid; gap:2px; text-align:center; }
.chart-tip { position:absolute; bottom:100%; left:0; z-index:10; display:grid; width:max-content; max-width:100%; margin-bottom:4px; padding:6px 10px; font-size:13px; line-height:1.35; pointer-events:none;
  background:var(--bg); border:1px solid var(--line); border-radius:8px; box-shadow:0 6px 18px rgba(0,0,0,.3); }
.chart-tip span { color:var(--muted); font-size:12px; }
.segbar { display:flex; gap:2px; height:28px; touch-action:pan-y; }
.seg { flex:1 1 0; align-items:center; justify-content:flex-start; padding:0 8px; border-radius:4px; color:var(--viz-on); font-size:13px; font-weight:600; overflow:visible; }
.slot.seg.on { filter:brightness(1.12); }
.legend { display:flex; flex-wrap:wrap; gap:6px 16px; margin-top:12px; font-size:13px; color:var(--muted); }
.legend span { display:inline-flex; align-items:center; gap:6px; }
.legend i { width:10px; height:10px; border-radius:2px; }
.legend b { color:var(--text); font-weight:600; }
.ranked { display:grid; gap:12px; }
.rank-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; font-size:14px; }
.rank-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rank-value { color:var(--muted); font-size:13px; font-variant-numeric:tabular-nums; }
.rank-track { grid-column:1 / -1; display:block; }
.rank-track i { display:block; height:8px; min-width:2px; border-radius:0 4px 4px 0; background:var(--viz-1); }
.chart-table { margin-top:10px; font-size:13px; }
.chart-table summary { color:var(--muted); cursor:pointer; padding:6px 0; }
.chart-table table { width:100%; border-collapse:collapse; font-variant-numeric:tabular-nums; }
.chart-table th, .chart-table td { padding:6px 0; text-align:left; border-top:1px solid var(--line); }
.chart-table th { color:var(--muted); font-weight:600; }
.chart-table th:last-child, .chart-table td:last-child { text-align:right; }

/* daily goals */
.goals { flex-basis:100%; display:grid; gap:10px; }
.goals:empty { display:none; }
.goal-head { display:flex; justify-content:space-between; gap:12px; font-size:14px; margin-bottom:4px; }
.meter { height:8px; border-radius:4px; background:var(--line); overflow:hidden; }
.meter i { display:block; height:100%; border-radius:4px; background:var(--viz-1); transition:width var(--dur-slow) var(--ease); }
.meter.over i { background:var(--danger); }
.goal-edit { justify-self:start; font-size:14px; padding:4px 0; min-height:32px; }

/* body tracking */
.body-log-btn { display:block; width:100%; margin-bottom:14px; }
.goals-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; }
.goals-head .link { padding:0; }
.goals-none { margin:0; }
.body-entry { width:100%; justify-content:space-between; text-align:left; color:inherit; font:inherit; }
.body-entry .name { flex:none; }
.macro-goals { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.macro-goal .n { font-weight:700; }
.macro-goal .l { color:var(--muted); font-size:13px; }

/* goal planner */
.plan-card h3 { margin:0 0 6px; font-size:16px; }
.plan-card .chart-head h3 { margin:0; }
.plan-card p { margin:0 0 4px; }
.plan-card .primary { display:block; width:100%; margin-top:12px; }
.plan-label { color:var(--muted); font-size:14px; margin-bottom:-6px; }
.choices { display:grid; gap:6px; }
.choice { display:flex; align-items:center; gap:10px; padding:10px 12px; min-height:52px; color:var(--text); background:var(--bg); border:1px solid var(--line); border-radius:10px; cursor:pointer; }
.choice:has(input:checked) { border-color:var(--accent); }
.choice:has(input:focus-visible) { outline:2px solid var(--accent); outline-offset:2px; }
.choice.disabled { opacity:.55; cursor:default; }
.choice input { flex:none; width:18px; height:18px; min-height:0; padding:0; margin:0; accent-color:var(--accent-fill); }
.choice span { display:grid; min-width:0; }
.choice strong { font-weight:600; font-size:15px; }
.choice small { color:var(--muted); font-size:13px; }
.plan-summary { margin:0; font-size:14px; min-height:1.5em; }
.plan-target { text-align:center; }
.plan-target .n { font-size:48px; font-weight:700; line-height:1.1; }
.plan-target .l { color:var(--muted); font-size:14px; }
.plan-why { margin:0; font-size:14px; }
.plan-warn { margin:0; font-size:14px; padding:10px 12px; border:1px solid var(--danger); border-radius:10px; }
.plan-styles { margin:0; }
.plan-styles button { padding:10px 4px; font-size:14px; white-space:nowrap; }

/* goal planner, full screen */
.wiz { position:fixed; inset:0; z-index:60; display:flex; flex-direction:column; height:100dvh; background:var(--bg); padding-top:env(safe-area-inset-top); }
.wiz-top { flex:none; display:flex; align-items:center; gap:12px; width:100%; max-width:520px; margin:0 auto; padding:12px 16px; }
.wiz-progress { flex:1; height:6px; border-radius:3px; background:var(--line); overflow:hidden; }
.wiz-progress i { display:block; height:100%; border-radius:3px; background:var(--viz-1); transition:width var(--dur-slow) var(--ease); }
.wiz-form { flex:1; min-height:0; display:flex; flex-direction:column; gap:0; }
.wiz-scroll { flex:1; min-height:0; overflow-y:auto; -webkit-overflow-scrolling:touch; }
.wiz-body { display:grid; gap:16px; width:100%; max-width:520px; margin:0 auto; padding:8px 20px 24px; }
.wiz-title { margin:0; font-size:30px; line-height:1.15; letter-spacing:-.5px; }
.wiz-body .eyebrow { margin-bottom:-10px; }
.wiz-intro { margin:-6px 0 4px; color:var(--muted); font-size:16px; }
.wiz-foot { flex:none; border-top:1px solid var(--line); background:var(--bg); padding:12px 20px max(12px, env(safe-area-inset-bottom)); }
.wiz-foot-inner { display:grid; gap:8px; width:100%; max-width:480px; margin:0 auto; }
.wiz-foot .error { min-height:0; }
.wiz-foot .error:empty { display:none; }
.wiz-next { width:100%; min-height:52px; font-size:17px; }
.wiz-mascot { display:block; width:120px; height:auto; margin:4px auto; animation:bob 1.6s ease-in-out infinite alternate; }
.wiz-list { list-style:none; margin:0; padding:0; display:grid; gap:10px; }
.wiz-list li { display:grid; gap:2px; padding:14px 16px; background:var(--card); border:1px solid var(--line); border-radius:14px; }
.wiz-list strong { font-weight:600; }
.wiz-list span { color:var(--muted); font-size:14px; }
.wiz-note { margin:0; color:var(--muted); font-size:13px; }
.wiz-center { text-align:center; }
.wiz-label { margin-bottom:-8px; }
.wiz-field { font-size:14px; }
.wiz-input { position:relative; display:block; }
.wiz-input input { font-size:20px; font-weight:600; min-height:56px; padding-right:52px; border-radius:12px; background:var(--card); }
.wiz-input em { position:absolute; right:14px; top:50%; transform:translateY(-50%); font-style:normal; color:var(--muted); font-size:14px; pointer-events:none; }
.wiz-choices { gap:8px; }
.wiz-choices .choice { min-height:64px; padding:14px 16px; gap:14px; background:var(--card); border-radius:14px; }
.wiz-choices .choice:has(input:checked) { box-shadow:inset 0 0 0 1px var(--accent); }
.wiz-choices .choice strong { font-size:16px; }
.wiz-choices .choice input { width:22px; height:22px; }
.wiz-units { margin:0; }
.wiz-summary { font-weight:600; }
.wiz-target .n { font-size:64px; letter-spacing:-1.5px; font-variant-numeric:normal; }
.plan-train { display:grid; gap:4px; padding:14px 16px; background:var(--card); border:1px solid var(--line); border-radius:14px; }
.plan-train strong { font-weight:600; }
.plan-train span { color:var(--muted); font-size:14px; }
.cal-breakdown { display:grid; gap:12px; padding:16px; background:var(--card); border:1px solid var(--line); border-radius:14px; }
.cal-breakdown h3 { margin:0; font-size:16px; }
.plan-card .cal-breakdown { padding:12px 0 0; background:none; border:0; border-radius:0; }
.cal-line-head { display:flex; justify-content:space-between; align-items:baseline; gap:12px; }
.cal-line-head > span { display:flex; align-items:baseline; font-weight:600; font-size:15px; }
.cal-line-head .key { flex:none; align-self:center; }
.cal-line-head b { font-size:17px; font-variant-numeric:tabular-nums; white-space:nowrap; }
.cal-line p { margin:2px 0 0; color:var(--muted); font-size:13px; line-height:1.4; }
.cal-total { padding-top:10px; border-top:1px solid var(--line); }
.cal-math { font-size:13px; }
.cal-math summary { color:var(--muted); cursor:pointer; padding:4px 0; }
.cal-math p { margin:6px 0 0; color:var(--muted); line-height:1.45; }
.cal-math strong { color:var(--text); font-weight:600; }
.macro-review { list-style:none; margin:0; padding:0; display:grid; gap:8px; }
.macro-review li { display:flex; gap:10px; font-size:14px; }
.macro-review strong { font-weight:600; }
.macro-review .mark { flex:none; display:grid; place-items:center; width:20px; height:20px; border-radius:50%; font-size:12px; font-weight:700; color:var(--viz-on); background:var(--ok); }
.macro-review .warn .mark { background:var(--viz-1); }
.macro-review .stop .mark { background:var(--danger); }
.plan-why[hidden], .plan-warn[hidden] { display:none; }
.plan-status .macro-review li { font-size:13px; line-height:1.35; }
.wiz-bar { height:10px; flex-basis:auto; }
.macro-cards { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.macro-card { display:grid; gap:6px; font-size:14px; }
.macro-card-name { display:flex; align-items:center; }
.macro-card .wiz-input input { padding-right:46px; }
.wiz-done { text-align:center; }
.wiz-done .prof-card { text-align:left; }
.wiz-done-actions .ghost { min-height:48px; }

/* recipes */
.recipe-new { display:block; width:100%; margin-bottom:14px; }
.recipe-row { padding-right:10px; }
.recipe-log { flex:none; padding:8px 14px; min-height:40px; }
.recipe-whole { flex-basis:100%; }
#recipe-totals { margin-bottom:0; }
.recipe-error { margin-top:12px; }
.recipe-save { display:block; width:100%; margin-top:4px; }

/* meals screen */
.meal-day { margin-bottom:12px; }
.meal-total { display:flex; flex-wrap:wrap; align-items:center; gap:12px 16px; background:var(--card); border:1px solid var(--line); border-radius:16px; padding:16px; }
.meal-total .kcal .n { font-size:30px; font-weight:700; line-height:1.1; }
.meal-total .l { color:var(--muted); font-size:13px; }
.macros { flex:1; display:grid; grid-template-columns:repeat(3,1fr); gap:8px; text-align:right; }
.macro .n { font-weight:700; }
.meal-head { display:flex; justify-content:space-between; }
.food-row { display:flex; align-items:center; gap:8px; background:var(--card); border:1px solid var(--line); border-radius:12px; padding:6px 4px 6px 14px; margin-bottom:8px; min-height:56px; }
.food-main { flex:1; min-width:0; display:block; }
.food-main .name, .food-main .meta { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.food-row .name { font-weight:600; }
.food-edit { background:none; border:0; padding:6px 0; text-align:left; color:inherit; cursor:pointer; }
.food-delete { display:block; margin:6px auto 0; color:var(--danger); }
.meta { color:var(--muted); font-size:13px; }
.food-kcal { font-weight:600; white-space:nowrap; }
.food-kcal small { color:var(--muted); font-weight:400; }
.add-food { width:100%; color:var(--muted); }
.meal-actions.two { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.copy-meal { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; color:var(--text); line-height:1.2; }
.copy-meal small { color:var(--muted); font-size:12px; font-weight:400; }

/* food dialog */
#food { width:min(94vw,440px); max-height:85vh; }
.food-form { gap:12px; }
.food-form .name { font-weight:600; }
.food-searchbar { display:flex; gap:8px; }
.food-searchbar input { flex:1; min-width:0; }
.food-searchbar .primary { padding:12px 14px; }
.food-results { display:grid; grid-template-columns:minmax(0,1fr); grid-auto-rows:max-content; align-content:start; gap:6px; margin-top:12px; }
.food-result { display:flex; align-items:center; gap:6px; background:var(--bg); border:1px solid var(--line); border-radius:10px; padding:0 6px 0 0; min-height:52px; }
.food-pick { flex:1; min-width:0; display:flex; align-items:center; gap:10px; background:none; border:0; padding:10px 6px 10px 12px; text-align:left; color:inherit; cursor:pointer; }
.food-pick > .meta { flex:none; }
.food-quick { flex:none; padding:0; font-size:24px; line-height:1; color:var(--accent); }
.food-quick.done { background:var(--flame); border-color:var(--accent-fill); color:#fff; animation:quick-added 520ms var(--ease-spring); }
.food-result.added { animation:flash 900ms var(--ease); }
/* the check pops in, while a ring spreads out from it */
@keyframes quick-added {
  0% { transform:scale(.6); box-shadow:0 0 0 0 rgba(254,151,2,.55); }
  55% { transform:scale(1.18); }
  100% { transform:none; box-shadow:0 0 0 14px rgba(254,151,2,0); }
}
.food-scan-btn { display:grid; place-items:center; padding:0; width:48px; color:var(--text); }
.food-result .name { font-weight:600; white-space:normal; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
.food-msg { margin:4px 0; text-align:center; }
.food-manual { display:block; margin:8px auto 0; }
.food-credit { font-size:12px; margin:6px 0 0; text-align:center; }
.food-credit a { color:inherit; }
.food-qty { display:grid; grid-template-columns:minmax(0,2fr) minmax(0,3fr); gap:10px; }
.food-note { font-size:12px; margin:0; }
.food-scan { display:flex; align-items:center; justify-content:center; width:100%; color:var(--text); font-size:16px; margin-top:12px; cursor:pointer; }
.food-center { text-align:center; margin-top:6px; }
.food-video { display:block; width:100%; max-height:50vh; object-fit:cover; background:#000; border-radius:12px; margin-bottom:10px; }
.food-shutter { display:block; width:100%; }
.food-scan-got { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:0 0 10px; font-weight:600; }
.food-scan-got span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.food-scan-got .link { flex:none; min-height:0; padding:4px 0; font-size:14px; }
.food-camera-back { grid-template-columns:1fr; margin-top:12px; }
.food-report { padding:0; min-height:0; font-size:12px; }
.food-preview { display:flex; flex-wrap:wrap; align-items:baseline; gap:12px; background:var(--bg); border-radius:10px; padding:12px; }
.food-preview span { color:var(--muted); font-size:14px; }

/* appearance setting */
.theme-picker { margin-bottom:0; }


/* color picker */
.color-grid { display:grid; grid-template-columns:repeat(5,1fr); gap:12px; margin:4px 0 14px; justify-items:center; }
.color-opt { width:44px; height:44px; border-radius:50%; border:2px solid transparent; }
.color-opt.sel { border-color:var(--text); box-shadow:0 0 0 2px var(--card), 0 0 0 4px var(--text); }
.color-opt.none { background:var(--bg); border:1px solid var(--line); color:var(--muted); font-size:18px; }
#colors #colors-cancel { width:100%; }

/* sudoku brain break */
#sudoku { width:min(94vw,400px); }
.sudoku-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:4px; }
.sudoku-head h3 { margin:0; }
.sudoku-timer { text-align:center; font-size:clamp(44px, 14vw, 64px); font-weight:800; line-height:1.1; font-variant-numeric:tabular-nums; color:var(--accent); }
.sudoku-scores { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:12px 0 14px; }
.sudoku-scores > div { display:grid; justify-items:center; gap:2px; background:var(--bg); border:1px solid var(--line); border-radius:12px; padding:8px 4px; }
.sudoku-scores strong { font-size:22px; font-variant-numeric:tabular-nums; }
.sudoku-scores span { font-size:12px; color:var(--muted); }
.sudoku-scores strong.bump { animation:score-bump 520ms var(--ease-spring); color:var(--accent); }
@keyframes score-bump { 40% { transform:scale(1.35); } }
.sudoku-total { margin:14px 0 0; text-align:center; font-size:14px; }
.sudoku-head .icon-btn { min-width:36px; min-height:36px; padding:0; font-size:16px; }
.sudoku-status { margin:0 0 10px; min-height:20px; }
.sudoku-grid { --n:4; display:grid; grid-template-columns:repeat(var(--n),1fr); grid-auto-rows:1fr;
  aspect-ratio:1; width:100%; max-width:260px; margin:0 auto; border:2px solid var(--text); background:var(--bg); }
.scell { border-right:1px solid var(--line); border-bottom:1px solid var(--line); }
.scell.re { border-right:0; }
.scell.br { border-right:2px solid var(--text); }
.scell.bb { border-bottom:2px solid var(--text); }
.scell .sinput { display:block; width:100%; height:100%; box-sizing:border-box; border:0; background:transparent;
  text-align:center; font-size:30px; font-weight:600; color:var(--accent); padding:0; min-height:0; border-radius:0; cursor:pointer; }
.scell.sel .sinput { outline:2px solid var(--accent); outline-offset:-2px; background:rgba(254,104,2,.16); }
.scell .sinput:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.scell .given { display:flex; width:100%; height:100%; align-items:center; justify-content:center; font-size:30px; font-weight:800; color:var(--text); }
.scell.bad .sinput { color:var(--bad-text); background:rgba(252,13,42,.28); }
.sudoku-pad { --n:4; display:grid; grid-template-columns:repeat(var(--n),1fr); gap:8px; width:100%; max-width:360px; margin:16px auto 0; }
.sudoku-pad.big { gap:4px; max-width:520px; }
.sudoku-pad.big button { min-height:52px; font-size:20px; border-radius:10px; }
.sudoku-pad button { min-height:56px; padding:0; font-size:24px; font-weight:700; border-radius:14px; background:var(--card); border:1px solid var(--line); color:var(--text); }
.sudoku-pad button[data-d] { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; line-height:1; }
.sudoku-pad small { font-size:11px; font-weight:500; color:var(--muted); }
.sudoku-pad .done { opacity:.4; }
.sudoku-actions { display:flex; justify-content:center; margin-top:14px; }
.sudoku-actions .ghost { width:100%; }
.sudoku-size { margin:10px 0 0; }

/* ---------- motion ---------- */
:root { --dur-fast:120ms; --dur:200ms; --dur-slow:280ms; --ease:cubic-bezier(.2,.8,.2,1); --ease-spring:cubic-bezier(.34,1.4,.64,1); --kb:0px; }
html { background:var(--bg); }
body, #tabbar, .item, .act, .stat, .panel, .food-row, .prof-card, .meal-total, input, select, textarea {
  transition:background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

/* touch feedback */
button { transition:transform var(--dur-fast) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), opacity var(--dur) var(--ease), filter var(--dur) var(--ease); }
button:not(:disabled):active { transform:scale(.96); }
.item-main:not(:disabled):active, .food-edit:not(:disabled):active, .act:not(:disabled):active { transform:scale(.985); }
.food-scan { transition:transform var(--dur-fast) var(--ease), border-color var(--dur) var(--ease); }
.food-scan:active { transform:scale(.97); }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset:-1px; }
.notes-box textarea:focus-visible { outline:none; }
@media (hover:hover) {
  .primary:hover, .save-btn:hover { filter:brightness(1.1); }
  .ghost:hover, .icon-btn:hover, .item:hover, .act:hover, .food-row:hover, .food-result:hover { border-color:var(--accent); }
  .link:hover, .x:hover, .stats-link:hover, #tabbar button:hover { color:var(--accent); }
  .wday:hover .wnum { box-shadow:inset 0 0 0 1px var(--accent); }
}
.wnum { transition:box-shadow var(--dur) var(--ease); }
#tabbar button.active svg { animation:tab-pop var(--dur-slow) var(--ease-spring); }
@keyframes tab-pop { from { transform:scale(.72); } to { transform:none; } }

/* screen transitions */
#tabbar { view-transition-name:tabbar; }
::view-transition { background:var(--bg); }
::view-transition-old(root) { animation:vt-fade-out 130ms var(--ease) both; }
::view-transition-new(root) { animation:vt-fade-in 220ms var(--ease) both; }
::view-transition-group(tabbar) { animation:none; z-index:2; }
[data-nav="forward"]::view-transition-old(root) { animation-name:vt-out-left; }
[data-nav="forward"]::view-transition-new(root) { animation-name:vt-in-right; }
[data-nav="back"]::view-transition-old(root) { animation-name:vt-out-right; }
[data-nav="back"]::view-transition-new(root) { animation-name:vt-in-left; }
@keyframes vt-fade-out { to { opacity:0; } }
@keyframes vt-fade-in { from { opacity:0; } }
@keyframes vt-out-left { to { opacity:0; transform:translateX(-18px); } }
@keyframes vt-in-right { from { opacity:0; transform:translateX(26px); } }
@keyframes vt-out-right { to { opacity:0; transform:translateX(18px); } }
@keyframes vt-in-left { from { opacity:0; transform:translateX(-26px); } }

/* content easing in */
@keyframes rise { from { opacity:0; transform:translateY(10px); } }
@keyframes fade-in { from { opacity:0; } }
.view-in .item, .view-in .act, .view-in .stat, .view-in .panel, .view-in .prof-card, .view-in .meal-total, .view-in .food-row, .view-in .avatar, .view-in .empty-hero {
  animation:rise var(--dur-slow) var(--ease) backwards;
}
.view-in .list > :nth-child(2), .view-in .stats > :nth-child(2), .view-in .panel:nth-of-type(2) { animation-delay:30ms; }
.view-in .list > :nth-child(3), .view-in .stats > :nth-child(3), .view-in .panel:nth-of-type(3) { animation-delay:60ms; }
.view-in .list > :nth-child(4), .view-in .stats > :nth-child(4) { animation-delay:90ms; }
.view-in .list > :nth-child(5) { animation-delay:120ms; }
.view-in .list > :nth-child(n+6) { animation-delay:150ms; }
.content-in { animation:fade-in var(--dur-slow) var(--ease); }
#auth form:not([hidden]) { animation:rise var(--dur) var(--ease); }
body > .card { animation:rise var(--dur-slow) var(--ease); }
.logo-mascot { animation:logo-pop 420ms var(--ease-spring) backwards; }
@keyframes logo-pop { from { opacity:0; transform:scale(.7) rotate(-6deg); } }

/* dialogs: fade in on large screens, and rise from the bottom on phones */
dialog {
  max-height:85dvh; overflow:auto; opacity:0; transform:translateY(10px) scale(.97);
  transition:opacity var(--dur) var(--ease), transform var(--dur-slow) var(--ease-spring), overlay var(--dur-slow) allow-discrete, display var(--dur-slow) allow-discrete;
}
dialog[open] { opacity:1; transform:none; }
@starting-style { dialog[open] { opacity:0; transform:translateY(16px) scale(.96); } }
dialog::backdrop { opacity:0; transition:opacity var(--dur) var(--ease), overlay var(--dur-slow) allow-discrete, display var(--dur-slow) allow-discrete; }
dialog[open]::backdrop { opacity:1; }
@starting-style { dialog[open]::backdrop { opacity:0; } }
@media (max-width:600px) {
  dialog, #sudoku, #food {
    width:100%; max-width:100%; margin:auto 0 0; bottom:var(--kb); border-width:1px 0 0; border-radius:22px 22px 0 0;
    max-height:calc(88dvh - var(--kb)); padding-bottom:max(20px, env(safe-area-inset-bottom)); transform:translateY(100%);
    transition:opacity var(--dur) var(--ease), transform var(--dur-slow) var(--ease), overlay var(--dur-slow) allow-discrete, display var(--dur-slow) allow-discrete;
  }
  dialog[open], #sudoku[open], #food[open] { transform:none; }
  @starting-style { dialog[open], #sudoku[open], #food[open] { opacity:1; transform:translateY(100%); } }
}
/* Adding food takes the whole screen: search and scan on top, then the list, which ends above the keyboard */
#food.food-page, dialog#exlookup, dialog#exguide {
  inset:0 0 auto; width:100%; max-width:none; height:calc(100dvh - var(--kb)); max-height:none; margin:0;
  border:0; border-radius:0; padding:max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
}
#food.food-page[open], #exlookup[open], #exguide[open] { display:flex; flex-direction:column; }
#food.food-page > *, #exlookup > *, #exguide > * { width:100%; max-width:640px; margin-inline:auto; }
#food.food-page #food-body { flex:1; min-height:0; display:flex; flex-direction:column; overflow-y:auto; }
#food.food-page .food-results, #exlookup .food-results { flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; }
#food.food-page .food-manual { flex:none; }
.food-results.live > * { animation:none; }
/* Adding an exercise: catalog matches with a small picture, and creating one by name stays in reach above the keyboard */
#exlookup .food-form { margin-top:4px; }
.exl-thumb { flex:none; width:40px; height:40px; border-radius:8px; object-fit:cover; background:var(--line); }
.exl-thumb.none { display:grid; place-items:center; font-size:20px; }
.exl-create { flex:none; margin-top:12px; }
#exl-q.nudge, .exn .nudge { animation:nudge 360ms var(--ease); }
/* New custom exercise: name, body group chips and intensity cards, with the add button kept in reach */
.exn:not([hidden]) { flex:1; min-height:0; display:flex; flex-direction:column; gap:0; }
.exn-fields { flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; display:grid; align-content:start; gap:18px; padding:4px 0 8px; }
.exn-back { justify-self:start; padding:0; }
.exn-set { margin:0; padding:0; border:0; min-width:0; }
.exn-set legend { padding:0; margin-bottom:8px; font-size:14px; color:var(--muted); }
.exn-groups { display:grid; grid-template-columns:repeat(auto-fill, minmax(76px, 1fr)); gap:8px; }
.exn-chip, .exn-level { position:relative; cursor:pointer; }
.exn-chip input, .exn-level input { position:absolute; opacity:0; pointer-events:none; }
.exn-chip span { display:grid; place-items:center; min-height:44px; padding:6px 4px; border-radius:12px; border:1px solid var(--line); background:var(--card);
  font-size:14px; font-weight:600; color:var(--text); text-align:center; line-height:1.15; transition:background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease); }
.exn-chip input:checked + span { background:var(--flame); border-color:transparent; color:#fff; }
.exn-chip:active span, .exn-level:active { transform:scale(.97); }
.exn-chip input:focus-visible + span, .exn-level:has(input:focus-visible) { outline:2px solid var(--accent); outline-offset:2px; }
.exn-levels { display:grid; gap:8px; }
.exn-level { display:grid; grid-template-columns:1fr auto; align-items:center; column-gap:12px; padding:12px 14px; border-radius:14px; border:1px solid var(--line); background:var(--card);
  color:var(--text); transition:border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur-fast) var(--ease); }
.exn-level-name { font-weight:700; }
.exn-level-about { grid-column:1; font-size:13px; color:var(--muted); }
.exn-bars { grid-column:2; grid-row:1 / span 2; display:flex; align-items:flex-end; gap:3px; height:18px; }
.exn-bars i { width:6px; border-radius:3px; background:var(--line); }
.exn-bars i:nth-child(1) { height:8px; } .exn-bars i:nth-child(2) { height:13px; } .exn-bars i:nth-child(3) { height:18px; }
.exn-level:has(input:checked) { border-color:var(--accent); background:color-mix(in srgb, var(--accent-fill) 14%, var(--card)); }
.exn-level:has(input:checked) .exn-bars i.on { background:var(--flame); }
.exn-hint { margin:-8px 0 0; font-size:13px; color:var(--muted); }
.exn-hint:empty { display:none; }
.exn-hint.bad { color:var(--bad-text); }
@keyframes nudge { 25% { translate:-6px 0; } 75% { translate:6px 0; } }
/* Pages with a search field open in place, without sliding or scaling: the field gets focus while the page
   appears, and a field that's moving or shrunk at that moment can make iOS zoom or jump to it. */
dialog#exlookup, #food.food-page { transform:none !important; transition:opacity var(--dur) var(--ease), overlay var(--dur) allow-discrete, display var(--dur) allow-discrete; }
@starting-style { dialog#exlookup[open], #food.food-page[open] { opacity:0; } }
.exl-credit { margin:8px 0 0; text-align:center; font-size:12px; }
/* The exercise guide: a full-bleed demo with the name over it, fact tiles, a cue timeline and a pinned video button */
dialog#exguide { padding:0; }
#exg-body { flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:none; }
#exg-body::-webkit-scrollbar { display:none; }
.exg-hero { position:relative; aspect-ratio:4/3.4; max-height:52dvh; width:100%; overflow:hidden; background:#fff; cursor:pointer; isolation:isolate; }
.exg-hero img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; opacity:0; transform:scale(1.06); transition:opacity 420ms var(--ease), transform 1600ms var(--ease); }
.exg-hero img.on { opacity:1; transform:scale(1); }
.exg-hero::after { content:""; position:absolute; inset:0; z-index:1; pointer-events:none;
  background:linear-gradient(to bottom, rgba(0,0,0,.42) 0, transparent 22%, transparent 42%, color-mix(in srgb, var(--bg) 70%, transparent) 76%, var(--bg) 100%); }
.exg-hero-skel, .exg-hero-empty { background:var(--card); cursor:default; }
.exg-hero-skel .skel { position:absolute; inset:0; border-radius:0; }
.exg-hero-empty { aspect-ratio:auto; min-height:200px; background:radial-gradient(120% 90% at 85% 0%, color-mix(in srgb, var(--accent-fill) 55%, transparent), transparent 60%), var(--card); }
.exg-close { position:absolute; z-index:3; top:max(14px, env(safe-area-inset-top)); right:14px; display:grid; place-items:center; width:38px; height:38px; padding:0;
  border-radius:999px; border:1px solid rgba(255,255,255,.22); color:#fff; background:rgba(20,6,24,.45); backdrop-filter:blur(14px) saturate(1.4); -webkit-backdrop-filter:blur(14px) saturate(1.4); }
.exg-close:active { transform:scale(.92); }
.exg-progress { position:absolute; z-index:2; top:max(16px, env(safe-area-inset-top)); left:14px; right:64px; display:flex; gap:6px; }
.exg-seg { flex:1; position:relative; display:grid; gap:6px; cursor:pointer; padding-bottom:4px; }
.exg-seg::before { content:""; height:3px; border-radius:3px; background:rgba(255,255,255,.35); }
.exg-seg i { position:absolute; left:0; top:0; height:3px; width:0; border-radius:3px; background:#fff; }
.exg-seg.done i { width:100%; }
.exg-seg.run i { animation:exg-fill var(--frame, 1400ms) linear forwards; }
.exg-seg b { font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:rgba(255,255,255,.6); text-shadow:0 1px 6px rgba(0,0,0,.5); transition:color var(--dur) var(--ease); }
.exg-seg.cur b { color:#fff; }
@keyframes exg-fill { from { width:0; } to { width:100%; } }
.exg-paused { position:absolute; z-index:2; top:calc(max(16px, env(safe-area-inset-top)) + 26px); left:14px; padding:3px 10px; border-radius:999px; font-size:12px; font-weight:600;
  color:#fff; background:rgba(20,6,24,.5); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); opacity:0; transform:translateY(-4px); transition:opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.exg-hero.paused .exg-paused { opacity:1; transform:none; }
.exg-hero-text { position:absolute; z-index:2; left:20px; right:20px; bottom:14px; }
.exg-hero-text h2 { margin:2px 0 0; font-size:clamp(28px, 8.5vw, 38px); line-height:1.05; font-weight:800; letter-spacing:-.02em; text-wrap:balance; text-transform:capitalize; }
.exg-kicker { font-size:12px; font-weight:700; letter-spacing:.14em; text-transform:uppercase; color:var(--accent); }
.exg-alias { margin-top:6px; font-size:14px; color:var(--muted); }
.exg-content { padding:8px 20px 24px; display:grid; gap:22px; }
.exg-tiles { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:8px; }
.exg-tiles > :first-child { grid-column:1 / -1; }
.exg-tile, .exg-tile-skel { min-height:72px; border-radius:16px; }
.exg-tile { display:flex; flex-direction:column; gap:4px; padding:12px; background:linear-gradient(160deg, color-mix(in srgb, var(--line) 55%, var(--card)), var(--card)); border:1px solid var(--line); }
.exg-tile-label { font-size:11px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); }
.exg-tile-value { font-size:16px; font-weight:700; line-height:1.2; }
.exg-tiles > :first-child .exg-tile-value { font-size:22px; letter-spacing:-.01em; }
.exg-tiles > :first-child { background:radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent-fill) 30%, transparent), transparent 60%), var(--card); }
.exg-meter { display:flex; gap:3px; margin-top:auto; }
.exg-meter i { flex:1; height:4px; border-radius:4px; background:var(--line); }
.exg-meter i.on { background:var(--flame); }
.exg-section h3 { display:flex; align-items:baseline; justify-content:space-between; margin:0 0 12px; font-size:13px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); }
.exg-count { font-size:12px; letter-spacing:0; text-transform:none; font-weight:500; }
.exg-pills { display:flex; flex-wrap:wrap; gap:8px; }
.exg-pills span { display:inline-flex; align-items:center; gap:7px; padding:6px 12px 6px 10px; border-radius:999px; font-size:14px; font-weight:500; background:var(--card); border:1px solid var(--line); }
.exg-pills span::before { content:""; width:7px; height:7px; border-radius:50%; background:var(--accent); }
.exg-steps { list-style:none; margin:0; padding:0; counter-reset:cue; }
.exg-steps li { counter-increment:cue; position:relative; padding:0 0 18px 46px; }
.exg-steps li::before { content:counter(cue); position:absolute; left:0; top:0; display:grid; place-items:center; width:30px; height:30px; border-radius:50%;
  font-size:14px; font-weight:800; color:#fff; background:var(--flame); box-shadow:0 4px 14px color-mix(in srgb, var(--accent-fill) 45%, transparent); }
.exg-steps li:not(:last-child)::after { content:""; position:absolute; left:14px; top:36px; bottom:6px; width:2px; border-radius:2px; background:linear-gradient(var(--line), transparent); }
.exg-steps p { margin:0; padding:4px 0 0; line-height:1.55; color:color-mix(in srgb, var(--text) 82%, transparent); }
.exg-steps strong { color:var(--text); font-weight:650; }
.exg-credit { margin:-6px 0 0; text-align:center; font-size:12px; }
.exg-credit a { color:inherit; }
.exg-empty { display:grid; justify-items:center; gap:10px; padding:24px 8px; text-align:center; color:var(--muted); }
.exg-empty strong { color:var(--text); }
.exg-empty-icon { display:grid; place-items:center; width:56px; height:56px; border-radius:18px; color:var(--accent); background:var(--card); border:1px solid var(--line); }
.exg-empty-icon svg { width:28px; height:28px; }
#exg-foot:empty { display:none; }
#exg-foot { flex:none; padding:12px 20px max(14px, env(safe-area-inset-bottom)); border-top:1px solid color-mix(in srgb, var(--line) 70%, transparent);
  background:color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px); }
.exg-watch { display:flex; align-items:center; justify-content:center; gap:10px; min-height:50px; border-radius:14px; font-weight:700; color:#fff; text-decoration:none; background:var(--flame);
  box-shadow:0 8px 24px color-mix(in srgb, var(--accent-fill) 35%, transparent); transition:transform var(--dur) var(--ease); }
.exg-watch:active { transform:scale(.98); }
.exg-actions { display:grid; grid-template-columns:auto 1fr; gap:10px; }
.exg-watch { white-space:nowrap; }
.exg-watch.alt { padding:0 14px; color:var(--text); background:var(--card); border:1px solid var(--line); box-shadow:none; }
button.exg-watch { width:100%; border:0; font:inherit; font-weight:700; }
.exg-plus { font-size:24px; line-height:1; font-weight:500; }
.exg-content > * { animation:rise var(--dur-slow) var(--ease) backwards; }
.exg-content > :nth-child(2) { animation-delay:60ms; }
.exg-content > :nth-child(n+3) { animation-delay:120ms; }
@media (prefers-reduced-motion: reduce) { .exg-hero img { transition:opacity 200ms; transform:none; } }
/* The brain break takes the whole screen, with the grid as large as fits */
dialog#sudoku {
  inset:0 0 auto; width:100%; max-width:none; height:calc(100dvh - var(--kb)); max-height:none; margin:0; overflow-y:auto; /* above any keyboard */
  border:0; border-radius:0; padding:max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
dialog#sudoku[open] { display:flex; flex-direction:column; }
#sudoku > * { width:100%; max-width:560px; margin-inline:auto; }
.sudoku-play { flex:1; display:flex; flex-direction:column; padding-top:8px; }
#sudoku .sudoku-status { text-align:center; font-size:16px; }
#sudoku .sudoku-grid { container-type:inline-size; }
#sudoku .scell .sinput, #sudoku .scell .given { font-size:clamp(14px, calc(52cqi / var(--n)), 52px); } /* digits scale with the grid */
/* The food dialog sits at the top, so the keyboard opening below never moves it */
#food { margin:max(12px, env(safe-area-inset-top)) auto auto; }
@media (max-width:600px) {
  #food {
    margin:0 0 auto; top:0; bottom:auto; border-width:0 0 1px; border-radius:0 0 22px 22px;
    padding-top:max(20px, env(safe-area-inset-top)); padding-bottom:20px; transform:translateY(-100%);
  }
  #food[open] { transform:none; }
  @starting-style { #food[open] { opacity:1; transform:translateY(-100%); } }
}
.food-video { aspect-ratio:4/3; }
.food-results > * { animation:rise var(--dur) var(--ease) backwards; }
.food-results > :nth-child(2) { animation-delay:25ms; }
.food-results > :nth-child(3) { animation-delay:50ms; }
.food-results > :nth-child(4) { animation-delay:75ms; }
.food-results > :nth-child(n+5) { animation-delay:100ms; }
.food-reading { display:grid; justify-items:center; gap:10px; padding:26px 0; }
.food-reading img { width:96px; height:auto; animation:bob 900ms var(--ease) infinite alternate; }

/* placeholders while loading */
.skel { display:block; border-radius:12px; background:linear-gradient(90deg,var(--card) 25%,var(--line) 50%,var(--card) 75%); background-size:200% 100%; animation:shimmer 1.2s linear infinite; }
.skel-row { height:58px; margin-bottom:8px; }
.skel-result { height:52px; }
.skel-panel { height:150px; border-radius:20px; margin-bottom:14px; }
.skel-stat { height:92px; border-radius:16px; }
@keyframes shimmer { from { background-position:200% 0; } to { background-position:-200% 0; } }

/* drag */
.item.dragging { scale:1.02; transition:scale var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }

/* moments */
.empty-hero { display:grid; justify-items:center; gap:8px; text-align:center; color:var(--muted); padding:18px 16px; }
.empty-hero img { width:92px; height:auto; animation:bob 1.6s ease-in-out infinite alternate; }
.empty-hero p { margin:0; }
@keyframes bob { from { transform:translateY(2px); } to { transform:translateY(-4px); } }
.burst { position:fixed; inset:0; z-index:100; pointer-events:none; overflow:hidden; }
.burst i { position:absolute; border-radius:50%; background:radial-gradient(circle,#ffe36b 0%,#fe9702 45%,#fc0d2a 100%); }
.save-btn.logged, .wday.sel.pop .wnum { animation:pop 320ms var(--ease-spring); }
@keyframes pop { from { transform:scale(.8); } }
.notes-box.flash { animation:flash 700ms var(--ease); }
@keyframes flash { from { border-color:var(--accent); box-shadow:0 0 0 3px rgba(254,104,2,.25); } }
.scell.bad { animation:shake 240ms var(--ease); }
@keyframes shake { 25% { transform:translateX(-3px); } 75% { transform:translateX(3px); } }
.sudoku-grid.solved .scell { background:rgba(254,151,2,.22); }
.sudoku-grid.solved .scell > * { animation:solve 480ms var(--ease-spring); }
.sudoku-grid.solved .scell:nth-child(4n+2) > * { animation-delay:40ms; }
.sudoku-grid.solved .scell:nth-child(4n+3) > * { animation-delay:80ms; }
.sudoku-grid.solved .scell:nth-child(4n) > * { animation-delay:120ms; }
@keyframes solve { 50% { transform:scale(1.28); } }

/* toast */
#toast { position:fixed; inset:auto 16px calc(84px + env(safe-area-inset-bottom)) 16px; z-index:90; display:none; width:auto; max-width:460px; margin:0 auto; padding:10px 10px 10px 16px;
  align-items:center; justify-content:space-between; gap:12px; min-height:48px; color:var(--text); background:var(--card); border:1px solid var(--line); border-radius:14px; box-shadow:0 10px 30px rgba(0,0,0,.35); }
#toast.open { display:flex; }
#toast.error-toast { border-color:var(--danger); }
#toast button { flex:none; background:none; border:0; color:var(--accent); font-weight:700; padding:6px 10px; min-height:36px; }
#confirm p { margin:0 0 16px; }

@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation-duration:.01ms !important; animation-delay:0s !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; scroll-behavior:auto !important; }
  dialog, dialog[open], #sudoku, #food { transform:none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation:none !important; }
}

/* ---------- profile ---------- */
.pf-hero { position:relative; overflow:hidden; border-radius:24px; padding:20px; margin-bottom:14px; border:1px solid var(--line);
  background:radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--accent-fill) 38%, transparent), transparent 55%),
             radial-gradient(90% 90% at 0% 100%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%), var(--card); }
.pf-id { display:flex; align-items:center; gap:14px; }
.pf-avatar { flex:none; display:grid; place-items:center; width:64px; height:64px; border-radius:50%; font-size:24px; font-weight:800; color:#fff; background:var(--flame);
  box-shadow:0 0 0 3px var(--card), 0 0 0 5px color-mix(in srgb, var(--accent) 70%, transparent), 0 10px 26px color-mix(in srgb, var(--accent-fill) 40%, transparent); }
.pf-who { min-width:0; }
.pf-name { margin:0; font-size:24px; line-height:1.15; font-weight:800; letter-spacing:-.02em; overflow-wrap:anywhere; }
.pf-email { margin-top:2px; font-size:14px; color:var(--muted); overflow-wrap:anywhere; }
.pf-kpis { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:8px; margin-top:18px; }
.pf-kpi, .pf-kpi-skel { min-height:70px; border-radius:14px; }
.pf-kpi { padding:10px 8px; text-align:center; background:color-mix(in srgb, var(--bg) 55%, transparent); border:1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.pf-kpi .n { font-size:24px; font-weight:800; line-height:1.15; font-variant-numeric:tabular-nums; }
.pf-kpi .l { margin-top:2px; font-size:11px; font-weight:600; letter-spacing:.04em; color:var(--muted); line-height:1.2; }
.pf-fire { font-size:16px; margin-left:1px; }
.pf-card { background:var(--card); border:1px solid var(--line); border-radius:22px; padding:18px; margin-bottom:14px; }
.pf-title { margin:0; font-size:19px; font-weight:800; letter-spacing:-.01em; }
.pf-sub { margin:2px 0 0; font-size:13px; color:var(--muted); }
.pf-focus-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px 12px; margin-bottom:16px; }
.pf-seg { flex:none; display:flex; padding:3px; gap:2px; border-radius:999px; background:var(--bg); border:1px solid var(--line); }
.pf-seg button { min-height:32px; padding:0 11px; border:0; border-radius:999px; background:none; color:var(--muted); font-size:13px; font-weight:700; }
.pf-seg button.active { background:var(--flame); color:#fff; }
.pf-score-skel { display:block; height:84px; border-radius:16px; margin-bottom:14px; }
.pf-bar-skel { display:block; height:44px; border-radius:10px; margin-top:8px; }
.pf-score { display:flex; align-items:center; gap:16px; }
.pf-ring { flex:none; position:relative; display:grid; place-items:center; width:78px; height:78px; border-radius:50%;
  background:conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); }
.pf-ring::before { content:""; position:absolute; inset:7px; border-radius:50%; background:var(--card); }
.pf-ring-n { position:relative; font-size:24px; font-weight:800; font-variant-numeric:tabular-nums; }
.pf-score-text { min-width:0; }
.pf-score-word { font-size:17px; font-weight:800; }
.pf-score-text p { margin:2px 0 0; font-size:14px; line-height:1.4; color:var(--muted); }
.pf-score-text strong { color:var(--text); }
.pf-trend { font-size:13px !important; }
.pf-attention { display:flex; align-items:flex-start; gap:8px; margin-top:14px; padding:10px 12px; border-radius:12px; font-size:14px; line-height:1.4;
  color:var(--text); background:color-mix(in srgb, var(--warn) 12%, transparent); border:1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.pf-attention svg { flex:none; margin-top:3px; color:var(--warn); }
.pf-bars { display:grid; gap:2px; margin-top:12px; }
.pf-bar-row summary { list-style:none; cursor:pointer; display:grid; grid-template-columns:1fr auto; column-gap:12px; row-gap:6px; padding:10px 8px; margin:0 -8px; border-radius:12px; }
.pf-bar-row summary::-webkit-details-marker { display:none; }
.pf-bar-row summary:hover, .pf-bar-row[open] summary { background:color-mix(in srgb, var(--line) 45%, transparent); }
.pf-bar-name { display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; font-weight:700; }
.pf-bar-pct { font-weight:700; font-variant-numeric:tabular-nums; text-align:right; }
.pf-bar-track { grid-column:1 / -1; height:10px; border-radius:4px; background:color-mix(in srgb, var(--line) 70%, transparent); overflow:hidden; }
.pf-bar-fill { display:block; height:100%; width:var(--w); border-radius:4px; background:var(--accent); transform-origin:left; animation:pf-grow 700ms var(--ease) backwards; }
.pf-bars > :nth-child(n+2) .pf-bar-fill { animation-delay:60ms; } .pf-bars > :nth-child(n+4) .pf-bar-fill { animation-delay:120ms; }
@keyframes pf-grow { from { transform:scaleX(0); } }
.pf-bar-meta { grid-column:1 / -1; margin-top:-2px; font-size:12px; color:var(--muted); }
.pf-bar-row.zero .pf-bar-name { color:var(--muted); }
.pf-flag { display:inline-flex; align-items:center; gap:4px; padding:1px 8px 1px 6px; border-radius:999px; font-size:11px; font-weight:700; color:var(--warn);
  background:color-mix(in srgb, var(--warn) 12%, transparent); border:1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.pf-flag svg { width:12px; height:12px; }
.pf-bar-list { list-style:none; margin:4px 0 8px; padding:0; display:grid; gap:4px; }
.pf-bar-list button { width:100%; display:flex; justify-content:space-between; gap:12px; padding:9px 12px; border-radius:10px; border:1px solid var(--line); background:var(--bg); text-align:left; font-size:14px; }
.pf-bar-list .muted { flex:none; font-size:13px; }
.pf-est { font-style:normal; font-size:11px; color:var(--muted); border:1px solid var(--line); border-radius:6px; padding:0 4px; }
.pf-bar-none { margin:2px 0 10px; font-size:13px; color:var(--muted); }
.pf-foot { margin:12px 0 0; font-size:12px; line-height:1.45; color:var(--muted); }
.pf-unassigned .link { padding:0; font-size:inherit; }
.pf-focus-empty { padding:10px 0 4px; text-align:center; color:var(--muted); }
.pf-focus-empty strong { color:var(--text); }
.pf-list { padding:6px; }
.pf-act { width:100%; display:flex; align-items:center; gap:12px; padding:12px; border:0; border-radius:14px; background:none; text-align:left; }
.pf-act:hover { background:color-mix(in srgb, var(--line) 45%, transparent); }
.pf-act + .pf-act { border-top:1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.pf-act-dot { flex:none; width:10px; height:10px; border-radius:50%; background:var(--flame); box-shadow:0 0 0 4px color-mix(in srgb, var(--accent-fill) 18%, transparent); }
.pf-act-main { flex:1; min-width:0; display:grid; }
.pf-act-main .name { font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pf-act-main .meta { font-size:13px; color:var(--muted); }
.pf-act-when { flex:none; font-size:13px; color:var(--muted); }
.pf-three { grid-template-columns:repeat(3, minmax(0,1fr)); }
.pf-three .stat { padding:14px 12px; }
.pf-three .stat .n { font-size:clamp(17px, 5.4vw, 22px); white-space:nowrap; }
.pf-settings { padding:6px 18px; }
.pf-setting { width:100%; display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:56px; padding:8px 0; font-weight:600; }
.pf-setting + .pf-setting { border-top:1px solid var(--line); }
.pf-setting .theme-picker { margin:0; }
.pf-setting .theme-picker button { padding:8px 12px; }
.pf-logout { border:0; background:none; color:var(--danger); text-align:left; }
@media (prefers-reduced-motion: reduce) { .pf-bar-fill { animation:none; } }

/* body map: two figures with a heat layer per muscle, multiplied over the art so its shading shows through */
.pf-map { display:grid; grid-template-columns:44fr 47.3fr; gap:6%; align-items:end; margin:18px auto 0; max-width:340px; }
.pf-fig { position:relative; margin:0; isolation:isolate; cursor:pointer; -webkit-user-select:none; user-select:none; }
.pf-fig img { display:block; width:100%; height:auto; aspect-ratio:var(--ar); }
.pf-heat { position:absolute; left:0; top:0; width:100%; aspect-ratio:var(--ar); background:var(--c, transparent); mix-blend-mode:multiply; pointer-events:none;
  -webkit-mask:var(--mask) 0 0 / 100% 100% no-repeat; mask:var(--mask) 0 0 / 100% 100% no-repeat; opacity:0; transition:opacity 500ms var(--ease); }
[data-level="1"] { --c:var(--heat-1); } [data-level="2"] { --c:var(--heat-2); } [data-level="3"] { --c:var(--heat-3); }
[data-level="4"] { --c:var(--heat-4); } [data-level="5"] { --c:var(--heat-5); }
.pf-heat:not([data-level="0"]) { opacity:1; }
.pf-heat.sel { opacity:1; background:var(--heat-sel); animation:pf-pulse 1.4s ease-in-out infinite; }
@keyframes pf-pulse { 50% { opacity:.55; } }
.pf-fig figcaption { margin-top:6px; text-align:center; font-size:11px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); }
.pf-legend { display:flex; align-items:center; justify-content:center; gap:4px; margin-top:12px; font-size:12px; color:var(--muted); }
.pf-legend span { margin:0 4px; }
.pf-legend i { width:22px; height:10px; border-radius:3px; background:var(--c); }
.pf-pick { margin-top:12px; min-height:64px; padding:12px 14px; border-radius:14px; background:var(--bg); border:1px solid var(--line); font-size:14px; line-height:1.45; }
.pf-pick strong, .pf-pick b { color:var(--text); }
.pf-pick-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.pf-pick-level { flex:none; padding:2px 10px; border-radius:999px; font-size:12px; font-weight:700; color:#2a1400; background:var(--c); }
.pf-pick-level[data-level="4"], .pf-pick-level[data-level="5"] { color:#fff; }
.pf-pick-level[data-level="0"] { color:var(--muted); background:var(--card); border:1px solid var(--line); }
.pf-pick-from { margin-top:4px; font-size:13px; color:var(--muted); }
.pf-breakdown { margin-top:14px; border-top:1px solid var(--line); }
.pf-breakdown > summary { list-style:none; cursor:pointer; display:flex; align-items:center; justify-content:space-between; padding:14px 0 4px; font-weight:700; }
.pf-breakdown > summary::-webkit-details-marker { display:none; }
.pf-chev { font-size:18px; line-height:1; color:var(--muted); transition:transform var(--dur) var(--ease); }
.pf-breakdown[open] .pf-chev { transform:rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .pf-heat.sel { animation:none; } }

/* ---------- workouts: home and folders ---------- */
.home-hero, .folder-hero { position:relative; overflow:hidden; border-radius:24px; padding:20px; margin:4px 0 6px; border:1px solid var(--line);
  background:radial-gradient(120% 130% at 100% 0%, color-mix(in srgb, var(--accent-fill) 34%, transparent), transparent 58%), var(--card); }
.home-kicker { font-size:12px; font-weight:700; letter-spacing:.14em; text-transform:uppercase; color:var(--accent); }
.home-greet h1, .folder-hero h1 { margin:2px 0 0; font-size:30px; line-height:1.08; font-weight:800; letter-spacing:-.02em; overflow-wrap:anywhere; }
.home-line { margin:6px 0 0; font-size:14px; color:var(--muted); }
.home-continue { width:100%; display:flex; align-items:center; gap:12px; margin-top:16px; padding:12px 12px 12px 12px; border-radius:16px; text-align:left;
  border:1px solid color-mix(in srgb, var(--line) 80%, transparent); background:color-mix(in srgb, var(--bg) 55%, transparent); color:var(--text);
  transition:transform var(--dur-fast) var(--ease), border-color var(--dur) var(--ease); }
.home-continue:hover { border-color:var(--accent); }
.home-continue:active { transform:scale(.985); }
.home-continue-icon { flex:none; display:grid; place-items:center; width:42px; height:42px; border-radius:13px; color:#fff; background:var(--flame);
  box-shadow:0 6px 18px color-mix(in srgb, var(--accent-fill) 40%, transparent); }
.home-continue-text { flex:1; min-width:0; display:grid; }
.home-continue-text .k { font-size:12px; color:var(--muted); }
.home-continue-text .v { font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.folder-hero { display:flex; align-items:center; gap:16px; --c:var(--accent);
  background:radial-gradient(120% 130% at 100% 0%, color-mix(in srgb, var(--c) 30%, transparent), transparent 60%), var(--card); }
.folder-hero-icon { flex:none; display:grid; place-items:center; width:60px; height:60px; border-radius:18px; color:var(--c);
  background:color-mix(in srgb, var(--c) 18%, transparent); border:1px solid color-mix(in srgb, var(--c) 35%, transparent); }
.folder-hero-icon svg { width:30px; height:30px; }
.folder-hero-text { min-width:0; }
.folder-hero h1 { font-size:26px; }

.sec-head { display:flex; align-items:center; gap:8px; margin:26px 0 10px; }
.sec-count { min-width:22px; padding:1px 7px; border-radius:999px; font-size:12px; font-weight:700; letter-spacing:0; text-align:center; color:var(--text); background:var(--line); }

.list { gap:10px; }
.item { gap:2px; padding:10px 6px 10px 10px; min-height:68px; border-radius:18px; border-color:color-mix(in srgb, var(--line) 85%, transparent);
  background:linear-gradient(180deg, color-mix(in srgb, var(--line) 22%, var(--card)), var(--card));
  box-shadow:0 1px 0 color-mix(in srgb, #fff 4%, transparent) inset, 0 6px 18px rgba(0,0,0,.18);
  transition:border-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease); }
.item:hover { border-color:color-mix(in srgb, var(--accent) 45%, var(--line)); }
.item-main { gap:12px; min-height:48px; }
.item-text { flex:1; min-width:0; display:grid; gap:1px; }
.item .name { font-size:16px; font-weight:700; letter-spacing:-.005em; }
.item .meta { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; color:var(--muted); }
.item .meta .sep { font-style:normal; margin:0 6px; opacity:.6; }
.item-today { flex:none; padding:3px 9px; border-radius:999px; font-size:11px; font-weight:700; color:#fff; background:var(--flame); }
.item-chev { flex:none; display:grid; place-items:center; color:var(--muted); }
.swatch { --c:var(--muted); display:grid; place-items:center; width:44px; height:44px; border-radius:14px; color:var(--c);
  background:color-mix(in srgb, var(--c) 16%, transparent); border:1px solid color-mix(in srgb, var(--c) 30%, transparent);
  transition:transform var(--dur-fast) var(--ease), background var(--dur) var(--ease); }
.swatch.exercise { border-radius:50%; }
.swatch.folder { border-radius:14px; }
.swatch.set { color:#fff; background:var(--c); border-color:transparent; box-shadow:0 4px 14px color-mix(in srgb, var(--c) 40%, transparent); }
.swatch svg { width:21px; height:21px; }
.stats-link { width:40px; height:40px; border-radius:12px; }
.stats-link:hover { color:var(--accent); background:color-mix(in srgb, var(--line) 50%, transparent); }
.grip { padding:10px 6px; font-size:18px; opacity:.55; }
.item:hover .grip { opacity:1; }
.item.dragging { border-color:var(--accent); box-shadow:0 18px 40px rgba(0,0,0,.55); }
.item.drop-into { background:color-mix(in srgb, var(--accent-fill) 18%, var(--card)); }
.empty { padding:18px; border-radius:18px; font-size:14px; }
.dropout { border-radius:16px; padding:14px; font-weight:600; }

.add-actions { gap:10px; margin-top:22px; }
.add-actions button { display:flex; align-items:center; justify-content:center; gap:8px; min-height:52px; border-radius:16px; font-size:clamp(13px, 4vw, 15px); font-weight:700; white-space:nowrap; }
.add-actions .ghost { color:var(--text); }
.add-actions .ghost svg { color:var(--accent); }
.add-actions .primary { box-shadow:0 10px 26px color-mix(in srgb, var(--accent-fill) 35%, transparent); }
.add-actions .plus { font-size:22px; line-height:1; font-weight:500; }
:root[data-theme="light"] .item { box-shadow:0 4px 14px rgba(39,4,44,.06); }
.topbar .icon-btn { display:grid; place-items:center; }

/* page titles (Workouts, Progress, Profile) and Home's quick actions */
.page-head { margin:6px 0 14px; }
.page-head h1 { margin:0; font-size:32px; line-height:1.1; font-weight:800; letter-spacing:-.02em; }
.page-head p { margin:4px 0 0; font-size:14px; color:var(--muted); }
.home-quicks { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:10px; margin-top:12px; }
.home-quick { display:flex; flex-direction:column; align-items:flex-start; gap:10px; padding:14px 12px; border-radius:18px; text-align:left; font-size:14px; font-weight:700;
  color:var(--text); background:var(--card); border:1px solid var(--line); transition:transform var(--dur-fast) var(--ease), border-color var(--dur) var(--ease); }
.home-quick:hover { border-color:var(--accent); }
.home-quick:active { transform:scale(.97); }
.home-quick-icon { display:grid; place-items:center; width:38px; height:38px; border-radius:12px; color:var(--accent); background:color-mix(in srgb, var(--accent-fill) 16%, transparent); }
.home-quick-icon svg { width:20px; height:20px; }
.home-kpis { grid-template-columns:repeat(3, minmax(0,1fr)); margin-top:0; }
.home-kpis .pf-kpi { background:var(--card); border-color:var(--line); }
.pf-kpis-card { margin:0 0 14px; }
.pf-kpis-card .pf-kpi { background:var(--card); border-color:var(--line); }
.sec-link { margin-left:auto; padding:0; font-size:13px; font-weight:600; letter-spacing:0; text-transform:none; }
.pf-link { border:0; background:none; color:var(--text); text-align:left; }
a.pf-setting { text-decoration:none; }
.pf-danger { color:var(--danger); }
.primary.danger-btn { background:var(--danger); }
#delete-account form { gap:12px; }
#delete-account h3 { margin:0; }
#delete-account p.muted { margin:0; font-size:14px; }
/* Admin "view as" banner: pinned to the top, pushes the page down. */
#viewas-banner { position:fixed; top:0; left:0; right:0; z-index:50; display:flex; align-items:center; justify-content:center; gap:12px;
  padding:max(8px, env(safe-area-inset-top)) 16px 8px; background:#b45309; color:#fff; font-size:14px; font-weight:600; }
#viewas-banner button { background:#fff; color:#b45309; border:0; border-radius:8px; padding:6px 14px; font-weight:700; min-height:32px; }
body.viewing-as { padding-top:calc(max(16px, env(safe-area-inset-top)) + 44px); }
.pf-settings + .pf-settings { margin-top:-4px; }
.pf-setting { flex-wrap:wrap; } .pf-setting .theme-picker { margin-left:auto; }

/* Progress: Training / Body sections, a compact score under the map, brain breaks on one card */
.pg-tabs { position:sticky; top:max(8px, env(safe-area-inset-top)); z-index:5; display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:4px; padding:4px; margin:0 0 16px;
  border-radius:16px; border:1px solid var(--line); background:color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); }
.pg-tabs button { min-height:40px; padding:0 4px; border:0; border-radius:12px; background:none; color:var(--muted); font-size:clamp(13px, 3.8vw, 15px); font-weight:700; }
.pg-tabs button.active { color:#fff; background:var(--flame); box-shadow:0 6px 16px color-mix(in srgb, var(--accent-fill) 30%, transparent); }
.page-head + .pg-tabs { margin-top:-2px; }
#pf-focus .pf-focus-head { margin-bottom:4px; }
#pf-focus .pf-map { margin-top:8px; }
#pf-focus .pf-score { gap:12px; margin-top:14px; padding:12px; border-radius:14px; background:var(--bg); border:1px solid var(--line); }
#pf-focus .pf-ring { width:52px; height:52px; }
#pf-focus .pf-ring::before { inset:5px; }
#pf-focus .pf-ring-n { font-size:17px; }
#pf-focus .pf-score-word { font-size:15px; }
.pf-score-of { font-weight:500; color:var(--muted); }
#pf-focus .pf-score-text p { font-size:13px; }
#pf-focus .pf-attention { margin-top:10px; }
.pf-how > summary { font-weight:600; color:var(--muted); }
.pf-how .pf-foot { margin:0 0 4px; }
#pf-focus .pf-breakdown { margin-top:10px; }
#pf-focus .pf-breakdown + .pf-breakdown { margin-top:0; }
.pf-brain { display:flex; align-items:center; gap:14px; padding:14px 16px; }
.pf-brain-icon { flex:none; display:grid; place-items:center; width:42px; height:42px; border-radius:13px; color:var(--accent); background:color-mix(in srgb, var(--accent-fill) 16%, transparent); }
.pf-brain-stats { flex:1; display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:8px; }
.pf-brain-stats div { display:grid; min-width:0; }
.pf-brain-stats b { font-size:17px; font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pf-brain-stats span { font-size:12px; color:var(--muted); }
.pg-meal-stats { width:100%; padding:0 18px; background:var(--card); border:1px solid var(--line); border-radius:18px; }

/* ---------- meals: day switcher, a calorie ring with macro bars, one card per meal ---------- */
.meal-day { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:0 0 12px; padding:4px; border-radius:16px; background:var(--card); border:1px solid var(--line); }
.meal-day .icon-btn { display:grid; place-items:center; min-width:40px; min-height:40px; padding:0; border:0; border-radius:12px; background:none; }
.meal-day .icon-btn:hover { background:color-mix(in srgb, var(--line) 55%, transparent); }
.meal-day strong { font-size:16px; font-weight:800; }
.meal-hero { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:center; gap:14px 18px; padding:18px; margin-bottom:6px; border-radius:24px; border:1px solid var(--line);
  background:radial-gradient(120% 130% at 0% 0%, color-mix(in srgb, var(--accent-fill) 26%, transparent), transparent 58%), var(--card); }
.kcal-ring { --p:0; position:relative; display:grid; place-items:center; width:124px; height:124px; border-radius:50%;
  background:conic-gradient(var(--accent) calc(var(--p) * 1%), color-mix(in srgb, var(--line) 85%, transparent) 0); transition:--p var(--dur-slow) var(--ease); }
.kcal-ring::before { content:""; position:absolute; inset:10px; border-radius:50%; background:var(--card); }
.kcal-ring.over { background:conic-gradient(var(--danger) calc(var(--p) * 1%), var(--line) 0); }
.kcal-center { position:relative; text-align:center; }
.kcal-center .n { font-size:28px; font-weight:800; line-height:1; font-variant-numeric:tabular-nums; letter-spacing:-.02em; }
.kcal-center .l { margin-top:4px; font-size:11px; color:var(--muted); max-width:84px; line-height:1.25; }
@property --p { syntax:"<number>"; inherits:true; initial-value:0; }
.mh-macros { display:grid; gap:12px; }
.mh-macro-head { display:flex; align-items:baseline; justify-content:space-between; gap:8px; margin-bottom:5px; font-size:13px; }
.mh-macro-name { display:flex; align-items:center; gap:6px; color:var(--muted); font-weight:600; }
.mh-macro .key { width:8px; height:8px; border-radius:50%; }
.mh-macro[data-k="protein"] { --m:var(--viz-1); } .mh-macro[data-k="carbs"] { --m:var(--viz-2); } .mh-macro[data-k="fat"] { --m:var(--viz-3); }
.mh-macro .key, .mh-track i { background:var(--m); }
.mh-macro-val b { font-weight:800; font-variant-numeric:tabular-nums; }
.mh-macro-val small { color:var(--muted); font-size:12px; }
.mh-track { height:8px; border-radius:4px; background:color-mix(in srgb, var(--line) 75%, transparent); overflow:hidden; }
.mh-track i { display:block; height:100%; width:0; border-radius:4px; transition:width var(--dur-slow) var(--ease); }
.mh-macro.over .mh-track i { background:var(--danger); }
.mh-macro.met .mh-macro-val b::after { content:" ✓"; color:var(--ok); }
.mh-status { grid-column:1 / -1; display:flex; align-items:center; justify-content:space-between; gap:12px; padding-top:12px; border-top:1px solid var(--line); font-size:14px; color:var(--muted); }
.mh-status b { color:var(--text); font-weight:800; }
.mh-status b.bad { color:var(--bad-text); }
.mh-status .sep { font-style:normal; margin:0 6px; opacity:.6; }
.mh-status .link { flex:none; padding:0; font-size:13px; }
.mh-macro-val { white-space:nowrap; }
@media (max-width:380px) {
  .meal-hero { gap:12px 14px; padding:16px; }
  .kcal-ring { width:96px; height:96px; } .kcal-ring::before { inset:8px; }
  .kcal-center .n { font-size:22px; } .kcal-center .l { font-size:10px; max-width:70px; }
  .mh-macro-head { font-size:12px; } .mh-macro-val small { font-size:11px; }
}

.meal-card { margin-top:12px; padding:6px; border-radius:22px; border:1px solid var(--line); background:var(--card); }
.meal-card .meal-head { display:flex; align-items:center; gap:12px; margin:0; padding:8px 10px; font-size:16px; letter-spacing:0; text-transform:none; color:var(--text); }
.meal-icon { flex:none; display:grid; place-items:center; width:38px; height:38px; border-radius:12px; font-size:19px; background:color-mix(in srgb, var(--line) 55%, transparent); }
.meal-title { flex:1; min-width:0; display:grid; font-weight:800; }
.meal-title small { font-size:12px; font-weight:500; color:var(--muted); }
.meal-kcal { font-weight:800; font-variant-numeric:tabular-nums; }
.meal-kcal small { font-weight:500; color:var(--muted); }
.meal-rows { margin:2px 4px 4px; border-radius:14px; background:var(--bg); border:1px solid color-mix(in srgb, var(--line) 70%, transparent); overflow:hidden; }
.meal-rows .food-row { margin:0; min-height:58px; padding:6px 4px 6px 14px; border:0; border-radius:0; background:none; }
.meal-rows .food-row + .food-row { border-top:1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.meal-rows .food-row:hover { background:color-mix(in srgb, var(--line) 30%, transparent); }
.meal-rows .food-main .meta { font-size:13px; color:var(--muted); }
.meal-rows .food-kcal { font-variant-numeric:tabular-nums; }
.meal-rows .x { display:grid; place-items:center; min-width:40px; min-height:40px; border-radius:12px; opacity:.6; }
.meal-rows .x:hover { opacity:1; color:var(--danger); background:color-mix(in srgb, var(--danger) 12%, transparent); }
.meal-card .meal-actions { padding:4px; }
.meal-card .add-food { min-height:46px; border-radius:14px; border-style:dashed; background:none; font-weight:700; color:var(--muted); }
.meal-card .add-food:hover { color:var(--accent); border-color:var(--accent); }
.meal-card .add-food .plus { font-size:18px; line-height:1; }
.meal-card .copy-meal { border-style:solid; background:color-mix(in srgb, var(--accent-fill) 10%, transparent); color:var(--text); }
.meal-card.empty-meal .meal-head { padding-bottom:4px; }

/* Target muscles: chips in the new-exercise form and the details panel */
.exn-muscles { grid-template-columns:repeat(auto-fill, minmax(112px, 1fr)); }
.exn-muscles .exn-chip span { min-height:40px; font-size:14px; text-align:center; line-height:1.15; }
.exn-optional { margin-left:6px; font-size:12px; font-weight:400; color:var(--muted); opacity:.8; }
.exd-muscles { margin:4px 0 12px; }
.exd-auto { margin:8px 0 0; font-size:13px; line-height:1.35; }

/* Breakdown by muscle */
.pf-muscles { display:grid; gap:14px; padding:6px 0 4px; }
.pf-mg h4 { margin:0 0 4px; font-size:12px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
.pf-mrow { all:unset; box-sizing:border-box; width:100%; display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px;
  padding:8px; margin:0 -8px; width:calc(100% + 16px); border-radius:10px; cursor:pointer; font-size:15px; }
.pf-mrow:hover { background:color-mix(in srgb, var(--line) 45%, transparent); }
.pf-mrow.on { background:color-mix(in srgb, var(--heat-sel) 14%, transparent); }
.pf-mrow:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.pf-mswatch { width:14px; height:14px; border-radius:4px; background:var(--c, transparent); border:1px solid color-mix(in srgb, var(--text) 18%, transparent); }
.pf-mswatch[data-level="0"] { background:transparent; }
.pf-mrow.on .pf-mswatch { box-shadow:0 0 0 2px var(--heat-sel); }
.pf-mname { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pf-mmeta { font-size:13px; color:var(--muted); white-space:nowrap; }

/* Muscle picker: the body group's muscles, then the rest of the body */
.exn-chip.assist span { border-style:dashed; border-color:color-mix(in srgb, var(--flame-solid, #f06a0c) 70%, var(--line)); }
.exn-assist-key { padding:0 4px; border:1px dashed color-mix(in srgb, #f06a0c 70%, var(--line)); border-radius:5px; }
.mp-more { margin-top:10px; }
.mp-more > summary { cursor:pointer; list-style:none; display:inline-flex; align-items:center; gap:6px; padding:6px 0; font-size:14px; font-weight:600; color:var(--accent); }
.mp-more > summary::-webkit-details-marker { display:none; }
.mp-more > summary::after { content:"⌄"; transition:transform .2s; }
.mp-more[open] > summary::after { transform:rotate(180deg); }
.mp-set { margin-top:10px; }
.mp-set h5 { margin:0 0 6px; font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
.exd-muscles .exd-auto { margin:0 0 10px; }
