:root {
  /* The Duo look: bright and friendly, one color per squad member. Dark is the default theme. */
  --bg:#17111d; --card:#17111d; --raised:#231a2b; --line:#34283f; --text:#f4eef8; --muted:#a395ae; --ok:#58cc02;
  --torch:#ff9600; --torch-edge:#cc7800; --sizzle:#58cc02; --sizzle-edge:#46a302; --ember:#1cb0f6; --ember-edge:#1899d6;
  --blaze:#ce82ff; --blaze-edge:#a568cc; --spark:#ffc800; --go:#ff4b4b; --go-edge:#cc3c3c;
  --accent:var(--torch); /* orange, for text and icons */
  --accent-fill:var(--torch); /* solid fills behind white text */
  --flame:var(--torch); /* the main button color */
  --danger:#ff6b6b; --bad-text:#ff8a98; --dot:#a395ae; --swatch-empty:#3a2f45;
  --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;
  --font:ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme:dark; /* native controls, such as dropdowns and scrollbars */
}
:root[data-theme="light"] {
  --bg:#ffffff; --card:#ffffff; --raised:#f7f7f7; --line:#e5e5e5; --text:#3c3c3c; --muted:#777777;
  --accent:#e07000; /* deeper orange, so orange text reads on white */
  --danger:#e5484d; --bad-text:#c22b31; --dot:#9a9a9a; --swatch-empty:#e5e5e5;
  --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 var(--font);
  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; }
/* The add sheet's picker: a Mon–Sun strip for day-based routines and folder badges for everything else.
   The lit badge is where new exercises go. Chunky 3D buttons like the Home tiles. */
.exl-pick { flex:none; display:grid; grid-template-columns:minmax(0,1fr); gap:8px; margin-top:12px; }
.exl-pick:empty { display:none; }
.exl-week { display:grid; grid-template-columns:repeat(7, minmax(0,1fr)); gap:6px; }
.exl-week .wk { position:relative; display:grid; place-items:center; height:46px; padding:0; border:2px solid var(--line); border-radius:14px;
  background:var(--card); box-shadow:0 3px 0 var(--line); color:var(--muted); font-size:15px; font-weight:800; cursor:pointer;
  transition:transform 80ms ease, box-shadow 80ms ease, background 150ms, border-color 150ms, color 150ms; }
.exl-week .wk:active { transform:translateY(3px); box-shadow:0 0 0 var(--line); }
.exl-week .wk.has { color:var(--text); }
.exl-week .wk i { position:absolute; bottom:5px; width:5px; height:5px; border-radius:50%; background:transparent; }
.exl-week .wk.has i { background:var(--torch); }
.exl-week .wk.today { border-color:color-mix(in srgb, var(--torch) 55%, var(--line)); }
.exl-week .wk.today::after { content:""; position:absolute; top:-5px; right:-3px; width:10px; height:10px; border-radius:50%; background:var(--go); border:2px solid var(--card); }
.exl-week .wk.on { background:var(--torch); border-color:var(--torch-edge); box-shadow:0 3px 0 var(--torch-edge); color:#fff; animation:exl-pop 220ms var(--ease); }
.exl-week .wk.on i { background:#fff; }
.exl-badges-head { display:flex; align-items:baseline; gap:8px; font-size:12px; font-weight:800; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); }
.exl-badges-head em { font-style:normal; text-transform:none; letter-spacing:0; font-size:13px; color:var(--torch); font-weight:700; }
.exl-badges-head em::before { content:"\2728 "; }
.exl-badges { display:flex; gap:8px; overflow-x:auto; padding:2px 2px 6px; margin:0 -2px; scrollbar-width:none; scroll-snap-type:x proximity; }
.exl-badges::-webkit-scrollbar { display:none; }
.exl-badge { --fc:var(--torch); flex:none; display:inline-flex; align-items:center; gap:7px; min-height:38px; padding:6px 12px; border-radius:999px;
  border:2px solid var(--line); background:var(--card); box-shadow:0 3px 0 var(--line); color:var(--text); font-size:14px; font-weight:800;
  scroll-snap-align:center; cursor:pointer; transition:transform 80ms ease, box-shadow 80ms ease, background 150ms, border-color 150ms; }
.exl-badge:active { transform:translateY(3px); box-shadow:0 0 0 var(--line); }
.exl-badge .dot { width:10px; height:10px; border-radius:50%; background:var(--fc); }
.exl-badge small { min-width:20px; padding:1px 6px; border-radius:999px; background:var(--line); color:var(--muted); font-size:11px; text-align:center; }
.exl-badge.on { border-color:var(--fc); background:color-mix(in srgb, var(--fc) 16%, var(--card)); box-shadow:0 3px 0 color-mix(in srgb, var(--fc) 70%, #000); animation:exl-pop 220ms var(--ease); }
.exl-badge.on small { background:var(--fc); color:#fff; }
@keyframes exl-pop { 0% { transform:scale(.92); } 60% { transform:scale(1.05); } 100% { transform:none; } }
.exl-sec { display:flex; align-items:baseline; justify-content:space-between; gap:8px; margin:6px 2px 0; }
.exl-sec b { font-size:18px; font-weight:800; }
.exl-sec span { font-size:13px; font-weight:700; color:var(--muted); }
.exl-card { --fc:var(--torch); display:flex; align-items:center; gap:12px; width:100%; min-height:60px; padding:10px 12px; text-align:left; color:var(--text);
  border:2px solid var(--line); border-left:6px solid var(--fc); border-radius:16px; background:var(--card); box-shadow:0 3px 0 var(--line); cursor:pointer;
  transition:transform 80ms ease, box-shadow 80ms ease; }
.exl-card:active { transform:translateY(3px); box-shadow:0 0 0 var(--line); }
.exl-card .food-main { flex:1; min-width:0; display:grid; }
.exl-card .name { font-weight:800; }
.exl-card .meta { font-size:13px; color:var(--muted); }
.exl-card-icon { flex:none; display:grid; place-items:center; width:40px; height:40px; border-radius:12px; background:color-mix(in srgb, var(--fc) 16%, var(--card)); color:var(--fc); font-weight:900; }
.exl-card.done .exl-card-icon { background:var(--sizzle); color:#fff; }
.exl-card-go { flex:none; padding:6px 12px; border-radius:999px; background:var(--torch); color:#fff; font-size:13px; font-weight:800; box-shadow:0 2px 0 var(--torch-edge); }
.exl-card.done .exl-card-go { background:var(--line); color:var(--muted); box-shadow:none; }
.exl-empty { display:flex; align-items:center; gap:12px; padding:14px; border:2px dashed var(--line); border-radius:16px; }
.exl-empty p { margin:0; font-size:14px; color:var(--muted); }
.exl-empty b { color:var(--text); }
.exl-empty-art { flex:none; width:64px; }
.exl-none { margin:0 2px; font-size:14px; }
/* Log cardio: the cardio you do as big tiles, the catalog's as chips to add with one tap */
.cardio-grid { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px; }
.cardio-tile { display:grid; justify-items:start; gap:2px; padding:12px; min-height:108px; text-align:left; color:var(--text);
  border:2px solid var(--spark); border-radius:18px; background:color-mix(in srgb, var(--spark) 12%, var(--card)); box-shadow:0 4px 0 #cca000; cursor:pointer;
  transition:transform 80ms ease, box-shadow 80ms ease; }
.cardio-tile:active { transform:translateY(4px); box-shadow:0 0 0 #cca000; }
.cardio-tile .ct-icon { display:block; width:64px; height:64px; margin:-4px 0 4px -4px; }
.cardio-chip .cc-icon { display:grid; place-items:center; margin:-4px 0 -4px -6px; }
.exl-thumb.none.cardio { background:none; }
.exl-thumb .cardio-art, .swatch .cardio-art { display:block; width:100%; height:100%; object-fit:contain; }
.swatch:has(.cardio-art) { background:none; overflow:visible; }
.cardio-tile b { font-size:15px; font-weight:800; overflow-wrap:anywhere; }
.cardio-tile small { font-size:12px; color:var(--muted); font-weight:600; }
.cardio-tile.done { border-color:var(--sizzle); background:color-mix(in srgb, var(--sizzle) 12%, var(--card)); box-shadow:0 4px 0 var(--sizzle-edge); }
.cardio-ideas { display:flex; flex-wrap:wrap; gap:8px; }
.cardio-chip { display:inline-flex; align-items:center; gap:6px; min-height:40px; padding:6px 8px 6px 12px; border-radius:999px; border:2px solid var(--line);
  background:var(--card); box-shadow:0 3px 0 var(--line); color:var(--text); font-size:14px; font-weight:700; cursor:pointer; transition:transform 80ms ease, box-shadow 80ms ease; }
.cardio-chip:active { transform:translateY(3px); box-shadow:0 0 0 var(--line); }
.cardio-chip .plus { display:grid; place-items:center; width:24px; height:24px; border-radius:50%; background:var(--spark); color:#3c3c3c; font-weight:900; }
.cardio-chip.done { border-color:var(--sizzle); }
.cardio-chip.done .plus { background:var(--sizzle); color:#fff; }
.exl-create .plus { font-weight:900; margin-right:2px; }
#exlookup .food-results { gap:8px; }
#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-cardio { display:grid; gap:18px; }
.exn-cardio[hidden] { display:none; }
.exn-icons { display:grid; grid-template-columns:repeat(auto-fill, minmax(64px, 1fr)); gap:8px; }
.exn-icon { position:relative; cursor:pointer; }
.exn-icon input { position:absolute; opacity:0; pointer-events:none; }
.exn-icon span { display:grid; place-items:center; height:64px; padding:4px; border-radius:14px; border:2px solid var(--line); background:var(--card); box-shadow:0 3px 0 var(--line); color:var(--muted);
  transition:transform 80ms ease, box-shadow 80ms ease, border-color 150ms, background 150ms; }
.exn-icon:active span { transform:translateY(3px); box-shadow:0 0 0 var(--line); }
.exn-icon input:checked + span { border-color:var(--torch); background:color-mix(in srgb, var(--spark) 25%, var(--card)); box-shadow:0 3px 0 var(--torch-edge); }
.exn-icon .cardio-art { width:100%; height:100%; object-fit:contain; }
.exn-icon input:focus-visible + span { outline:2px solid var(--accent); outline-offset:2px; }
.exn-units { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:8px; }
.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; }

/* Torch Squad banners (public/squad.js): one thin banner above the tab bar (and above open dialogs),
   in the speaking character's color, with a chunky bottom edge. Highlights add a bold headline. */
#squad-chip { --who:#ff9600; --who-edge:#d97f00;
  position:fixed; inset:auto 12px calc(84px + env(safe-area-inset-bottom)) 12px; z-index:95; display:none; width:auto; max-width:480px;
  margin:0 auto; padding:8px 14px 8px 8px; align-items:center; gap:10px; color:var(--text); background:var(--card); overflow:visible;
  border:2px solid var(--who); border-radius:18px; box-shadow:0 4px 0 var(--who-edge), 0 14px 30px rgba(0,0,0,.28); cursor:pointer; }
#squad-chip[data-who="sizzle"] { --who:#58cc02; --who-edge:#46a302; }
#squad-chip[data-who="ember"] { --who:#1cb0f6; --who-edge:#1899d6; }
#squad-chip[data-who="blaze"] { --who:#ce82ff; --who-edge:#a568cc; }
#squad-chip[data-who="spark"] { --who:#ffc800; --who-edge:#d9a900; }
#squad-chip.open { display:flex; animation:banner-in .4s cubic-bezier(.3,1.5,.5,1); }
#squad-chip > img { flex:none; width:56px; height:56px; margin:-18px 0 -4px; filter:drop-shadow(0 3px 4px rgba(0,0,0,.25)); }
#squad-chip.highlight > img { animation:banner-hop .6s cubic-bezier(.3,1.6,.5,1) .15s both; }
.squad-chip-text { min-width:0; flex:1; display:grid; gap:1px; }
.squad-chip-text strong { font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.1em; color:var(--who); }
.squad-chip-headline { font-size:16px; font-weight:800; line-height:1.2; overflow-wrap:anywhere; }
.squad-chip-text p { margin:0; font-size:14px; font-weight:600; line-height:1.3; }
#squad-chip.highlight p { color:var(--muted); font-style:italic; }
.squad-chip-actions { display:flex; gap:8px; margin-top:8px; }
.squad-chip-actions button { flex:1; min-height:40px; padding:6px 10px; border-radius:12px; font-size:14px; font-weight:700; }
@keyframes banner-in { from { opacity:0; transform:translateY(18px) scale(.96); } }
@keyframes banner-hop { 0% { transform:translateY(10px) scale(.7); } 60% { transform:translateY(-8px) scale(1.1); } 100% { transform:none; } }
.pf-hint { display:block; font-size:12px; font-weight:400; color:var(--muted); }
.pf-setting select { width:auto; min-height:40px; padding:6px 10px; }
label.pf-setting { display:flex; color:var(--text); font-size:inherit; }
.pf-setting .theme-picker button { white-space:nowrap; }
@media (prefers-reduced-motion: reduce) { #squad-chip.open, #squad-chip.highlight > img { animation:none; } }

/* Logged sets: newest first under the log form. Tap a set to change its weight or reps. */
.sets-box { margin-top:18px; border-top:1px solid var(--line); padding-top:14px; }
.sets-head { display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:8px; }
.sets-head h3 { margin:0; font-size:15px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); font-weight:700; }
.sets-count { display:inline-block; min-width:22px; padding:1px 7px; margin-left:4px; border-radius:999px; background:var(--line); color:var(--text); font-size:12px; letter-spacing:0; text-align:center; }
#rest-timer { font-size:14px; font-weight:700; color:var(--accent); font-variant-numeric:tabular-nums; }
.sets-empty { margin:4px 0 0; font-size:14px; }
.sets-list { list-style:none; margin:0; padding:0; display:grid; gap:6px; }
.set-main { width:100%; display:grid; grid-template-columns:28px 1fr auto; align-items:center; gap:10px; min-height:52px; padding:8px 12px;
  background:var(--bg); border:1px solid var(--line); border-radius:12px; color:var(--text); text-align:left; }
.set-main:hover { border-color:var(--accent); }
.set-n { width:26px; height:26px; border-radius:50%; background:var(--line); color:var(--muted); font-size:13px; font-weight:700; display:grid; place-items:center; }
.set-what { font-size:17px; font-weight:700; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.set-when { display:grid; justify-items:end; font-size:13px; color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
.set-when em { font-style:normal; font-size:12px; color:var(--accent); }
.set-row.just-logged .set-main { animation:set-in .5s var(--ease) both; border-color:var(--accent); }
@keyframes set-in { from { opacity:0; transform:translateY(-8px) scale(.98); } }
.set-row.editing { padding:12px; border:1px solid var(--accent); border-radius:12px; background:var(--bg); }
.set-edit { display:grid; grid-template-columns:28px 1fr; gap:10px 10px; align-items:start; }
.set-edit .set-n { margin-top:24px; }
.set-fields { display:flex; gap:8px; min-width:0; }
.set-fld { flex:1; min-width:0; display:grid; gap:4px; font-size:13px; color:var(--muted); }
.set-fld input { font-size:18px; font-weight:700; padding:10px; }
.set-edit .error { grid-column:1 / -1; }
.set-edit .error:empty { display:none; }
.set-edit-actions { grid-column:1 / -1; display:flex; align-items:center; gap:8px; }
.set-edit-actions .set-delete { color:var(--danger); margin-right:auto; }
.set-edit-actions .ghost, .set-edit-actions .primary { min-height:40px; padding:8px 16px; }
@media (prefers-reduced-motion: reduce) { .set-row.just-logged .set-main { animation:none; } }

/* ==========================================================================
   Duo look: the Duolingo-style design. Home pieces below; the app-wide components follow.
   Bright and friendly: rounded bold type, 2px borders, chunky buttons with a darker bottom
   edge that press down, and one color per squad member. Rolls out to the rest of the app
   once approved.
   ========================================================================== */
body { font-family:var(--font); }
#app { padding-bottom:110px; }
.duo-top { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:6px; min-height:48px; }
.duo-top .brand-bar img { height:34px; }
.duo-top .brand-bar img + img { height:30px; }
.duo-streak { display:inline-flex; align-items:center; gap:4px; padding:6px 12px; border:2px solid var(--line); border-radius:999px;
  font-size:17px; font-weight:800; color:var(--muted); }
.duo-streak.lit { color:var(--torch); border-color:color-mix(in srgb, var(--torch) 40%, var(--line)); }
.duo-streak:not(.lit) span { filter:grayscale(1); opacity:.6; }

.duo-hero { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:6px 0 14px; }
.duo-hero-text { min-width:0; }
.duo-kicker { font-size:13px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
.duo-hero h1 { margin:2px 0 4px; font-size:34px; line-height:1.05; font-weight:900; letter-spacing:-.02em; overflow-wrap:anywhere; }
.duo-hero p { margin:0; font-size:16px; font-weight:600; color:var(--muted); }
.duo-hero-art { flex:none; height:140px; margin:-12px -4px -6px 0; }

/* Chunky buttons: a solid face and a darker bottom edge; pressing sinks the face onto the edge. */
.duo-btn { display:flex; align-items:center; justify-content:center; gap:10px; width:100%; min-height:56px; padding:12px 18px;
  border:0; border-radius:16px; font-weight:800; font-size:17px; letter-spacing:.02em; color:#fff;
  transition:transform 80ms ease, box-shadow 80ms ease; }
.duo-btn:active { transform:translateY(4px); }
.duo-btn-go { background:var(--go); box-shadow:0 4px 0 var(--go-edge); }
.duo-btn-go:active { box-shadow:0 0 0 var(--go-edge); }
.duo-continue { flex-direction:column; gap:0; text-transform:none; }
.duo-continue .k { font-size:12px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; opacity:.85; }
.duo-continue .v { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* One tile per squad member, in their color, with the character on it. */
.duo-tiles { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:10px; margin:16px 0 6px; }
.duo-tile { --c:var(--torch); --e:var(--torch-edge); display:flex; flex-direction:column; align-items:center; gap:2px; padding:8px 6px 12px;
  border:2px solid var(--c); border-radius:18px; background:color-mix(in srgb, var(--c) 12%, var(--card));
  box-shadow:0 4px 0 var(--e); color:var(--text); font-size:14px; font-weight:800; transition:transform 80ms ease, box-shadow 80ms ease; }
.duo-tile:active { transform:translateY(4px); box-shadow:0 0 0 var(--e); }
.duo-tile.sizzle { --c:var(--sizzle); --e:var(--sizzle-edge); }
.duo-tile.ember { --c:var(--ember); --e:var(--ember-edge); }
.duo-tile-art { height:78px; margin-top:-2px; }
.duo-tile span { line-height:1.15; text-align:center; }

.duo-h2 { display:flex; align-items:center; justify-content:space-between; margin:22px 0 10px; font-size:21px; font-weight:900; letter-spacing:-.01em; }
.duo-link { background:none; border:0; padding:6px 0; font-size:14px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--accent); }

.duo-stats { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:10px; }
.duo-stat, .duo-stat-skel { min-height:86px; border-radius:16px; }
.duo-stat { display:grid; align-content:center; justify-items:center; gap:2px; padding:10px 6px; border:2px solid var(--line); text-align:center; }
.duo-stat .n { font-size:28px; font-weight:900; line-height:1.1; font-variant-numeric:tabular-nums; }
.duo-stat .l { font-size:12px; font-weight:800; color:var(--muted); line-height:1.2; }
.duo-stat.streak .n { color:var(--torch); }
.duo-stat.week .n { color:var(--blaze); }
.duo-stat.month .n { color:var(--ember); }

.duo-list { display:grid; gap:10px; }
.duo-row { display:flex; align-items:center; gap:12px; width:100%; min-height:68px; padding:10px 14px 10px 10px; text-align:left;
  border:2px solid var(--line); border-radius:16px; background:var(--card); box-shadow:0 4px 0 var(--line); color:var(--text);
  transition:transform 80ms ease, box-shadow 80ms ease; }
.duo-row:active { transform:translateY(4px); box-shadow:0 0 0 var(--line); }
.duo-row-icon { flex:none; display:grid; place-items:center; width:44px; height:44px; border-radius:12px; color:#fff; background:var(--torch); }
.duo-row-icon svg { width:22px; height:22px; }
.duo-row-main { flex:1; min-width:0; display:grid; }
.duo-row-main .name { font-size:16px; font-weight:800; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.duo-row-main .meta { font-size:13px; font-weight:600; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.duo-row-when { flex:none; font-size:13px; font-weight:800; color:var(--muted); }

.duo-empty { display:grid; justify-items:center; gap:8px; padding:18px 12px; text-align:center; border:2px dashed var(--line); border-radius:18px; }
.duo-empty img { width:120px; height:120px; }
.duo-empty p { margin:0; font-weight:600; color:var(--muted); }

/* A flat, full-width tab bar; the current tab sits in a rounded outline. */
#tabbar { left:0; right:0; bottom:0; width:100%; translate:none; border-radius:0; border:0; border-top:2px solid var(--line);
  padding:6px 8px max(6px, env(safe-area-inset-bottom)); background:var(--bg); backdrop-filter:none; -webkit-backdrop-filter:none; box-shadow:none; }
#tabbar::before { top:6px; bottom:max(6px, env(safe-area-inset-bottom)); left:8px; width:calc((100% - 16px) / 5); border-radius:14px;
  background:color-mix(in srgb, var(--torch) 12%, transparent); box-shadow:inset 0 0 0 2px var(--torch); }
#tabbar button { font-weight:800; color:var(--muted); }
#tabbar button.active { color:var(--torch); }
#squad-chip { bottom:calc(80px + env(safe-area-inset-bottom)); }

/* Squad idle animations: a 24-frame strip stepped through at 10 frames a second, looping.
   The box takes its shape from aspect-ratio and its height from where it's used. */
.idle-sprite { display:block; background:var(--idle) 0 0 / 2400% 100% no-repeat; animation:idle-loop 2.4s steps(24, jump-none) infinite; }
@keyframes idle-loop { to { background-position:100% 0; } }
@media (prefers-reduced-motion: reduce) { .idle-sprite { animation:none; } }

/* ==========================================================================
   Duo look across the app: chunky 2px borders, buttons that press down onto a darker
   bottom edge, rounded bold type. Overrides the older component styles above.
   ========================================================================== */
h1, h2, h3, .page-head h1, .hdr h1 { font-weight:900; letter-spacing:-.02em; }
h2.section { font-size:19px; font-weight:900; text-transform:none; letter-spacing:-.01em; color:var(--text); margin:24px 0 10px; }
.eyebrow, .home-kicker { font-weight:800; letter-spacing:.08em; color:var(--muted); }

/* buttons */
.primary, .save-btn { background:var(--torch); color:#fff; border:0; border-radius:16px; font-weight:800; font-size:16px; letter-spacing:.01em;
  box-shadow:0 4px 0 var(--torch-edge); transition:transform 80ms ease, box-shadow 80ms ease, opacity 120ms; }
.primary { min-height:50px; padding:12px 16px; }
.primary:active:not(:disabled), .save-btn:active { transform:translateY(4px); box-shadow:0 0 0 var(--torch-edge); opacity:1; }
.primary:disabled { opacity:.55; }
.primary.danger-btn { background:var(--go); box-shadow:0 4px 0 var(--go-edge); }
.ghost, .actions .ghost, .dlg-actions button:not(.primary) { background:var(--card); color:var(--text); border:2px solid var(--line); border-radius:16px;
  box-shadow:0 4px 0 var(--line); font-weight:800; min-height:50px; transition:transform 80ms ease, box-shadow 80ms ease; }
.ghost:active, .dlg-actions button:not(.primary):active { transform:translateY(4px); box-shadow:0 0 0 var(--line); }
.icon-btn { background:var(--card); border:2px solid var(--line); border-radius:14px; box-shadow:0 3px 0 var(--line); color:var(--text);
  transition:transform 80ms ease, box-shadow 80ms ease; }
.icon-btn:active { transform:translateY(3px); box-shadow:0 0 0 var(--line); }
.icon-btn.on { background:var(--torch); border-color:var(--torch-edge); box-shadow:0 3px 0 var(--torch-edge); color:#fff; }
.icon-btn.danger { color:var(--danger); }
.cal-head .icon-btn { box-shadow:none; border-color:transparent; }
.link { font-weight:800; }

/* fields */
input, select, textarea { font-family:inherit; }
input, select { border:2px solid var(--line); border-radius:14px; background:var(--raised); font-weight:600; }
input:focus, select:focus { outline:none; border-color:var(--ember); background:var(--card); }
input.big { border-radius:16px; background:var(--raised); font-weight:800; }
label { font-weight:700; }
.notes-box { border:2px solid var(--line); border-radius:16px; background:var(--raised); }
.notes-box:focus-within { border-color:var(--ember); background:var(--card); }

/* segmented choices (tabs, ranges, theme) */
.tabs { background:var(--raised); border:2px solid var(--line); border-radius:16px; padding:3px; gap:3px; }
.tabs button { border-radius:12px; font-weight:800; color:var(--muted); }
.tabs button.active { background:var(--card); color:var(--accent); box-shadow:inset 0 0 0 2px var(--torch); }

/* cards and lists */
.panel, .pf-card, .stat, .meal-total, .prof-card { border:2px solid var(--line); border-radius:20px; background:var(--card); box-shadow:none; }
.item { border:2px solid var(--line); border-radius:16px; background:var(--card); box-shadow:0 4px 0 var(--line); min-height:64px; }
.item .name { font-weight:800; }
.item:has(.item-main:active) { transform:translateY(3px); box-shadow:0 1px 0 var(--line); }
.empty, .dropout { border:2px dashed var(--line); border-radius:16px; font-weight:600; }
.pf-kpi { border:2px solid var(--line); border-radius:16px; background:var(--card); }
.pf-kpi .n { font-weight:900; color:var(--accent); }
.pf-kpi .l { font-weight:800; }
.empty-hero img { width:130px; height:130px; }
.empty-hero p { font-weight:600; }

/* dialogs, toast */
dialog { border:2px solid var(--line); border-radius:22px; background:var(--card); }
dialog::backdrop { background:rgb(10 6 14 / .62); }
#toast { border:2px solid var(--line); border-radius:16px; box-shadow:0 4px 0 var(--line), 0 12px 28px rgba(0,0,0,.25); font-weight:700; }

/* calendar */
.mday.sel span, .wday.sel .wnum { background:var(--torch); color:#fff; font-weight:900; }
.mday.on span { background:color-mix(in srgb, var(--torch) 22%, transparent); }
.mday.today span { color:var(--accent); }

/* logged sets */
.set-main { border:2px solid var(--line); border-radius:16px; background:var(--card); box-shadow:0 3px 0 var(--line); }
.set-main:active { transform:translateY(3px); box-shadow:0 0 0 var(--line); }
.set-n { background:var(--torch); color:#fff; font-weight:900; }
.set-what { font-weight:900; }
.set-row.editing { border:2px solid var(--ember); border-radius:16px; }
.sets-count { background:var(--torch); color:#fff; }

/* auth card */
body > .card { border:2px solid var(--line); border-radius:24px; background:var(--card); }
.logo-full { width:240px; height:auto; }
body > .card .logo { margin-bottom:22px; }

/* the brand mark in a page header */
.brand-bar img { height:34px; width:auto; }

/* Strength or cardio, when creating an exercise: a two-way choice with a hint under each. */
.exn-kind { display:grid; grid-template-columns:1fr 1fr; margin:0; }
.exn-kind label { position:relative; display:grid; justify-items:center; gap:0; padding:8px 6px; border-radius:12px; cursor:pointer; color:var(--muted); font-weight:800; }
.exn-kind input { position:absolute; opacity:0; pointer-events:none; }
.exn-kind label:has(input:checked) { background:var(--card); color:var(--accent); box-shadow:inset 0 0 0 2px var(--torch); }
.exn-kind label:has(input:focus-visible) { outline:2px solid var(--ember); outline-offset:2px; }
.exn-kind small { font-size:11px; font-weight:700; color:var(--muted); }
.form-hint { margin:8px 0 0; font-size:13px; font-weight:600; }


/* ---------- AI Coach: the chat with Blaze and Sizzle (public/coach.js) ---------- */

:root { --blaze-ink:var(--blaze); --sizzle-ink:var(--sizzle); }
:root[data-theme="light"] { --blaze-ink:#7a35b0; --sizzle-ink:#3d8a00; } /* readable small text on white */

.coach-top { justify-content:space-between; }
.coach-title { display:flex; align-items:center; gap:6px; font-weight:800; }
.coach-title img { width:28px; height:28px; border-radius:50%; background:var(--raised); object-fit:contain; }
.coach-title span { margin-left:4px; }
.icon-btn:disabled { opacity:.35; }
.coach-log { display:flex; flex-direction:column; gap:10px; width:100%; max-width:520px; margin:0 auto; padding:8px 16px 24px; }
.cb { display:flex; align-items:flex-end; gap:8px; max-width:88%; }
.cb-face { flex:none; width:40px; height:40px; border-radius:50%; background:var(--raised); object-fit:contain; }
.cb-text { padding:10px 14px; border-radius:18px 18px 18px 6px; background:var(--raised); border:1px solid var(--line); font-size:16px; line-height:1.4; overflow-wrap:anywhere; }
.cb-text b { display:block; font-size:12px; letter-spacing:.06em; text-transform:uppercase; color:var(--blaze-ink); margin-bottom:2px; }
.cb:has(img[src*="sizzle"]) .cb-text b { color:var(--sizzle-ink); }
.cb.me { align-self:flex-end; }
.cb.me .cb-text { background:#8446bd; border-color:#6a3699; color:#fff; border-radius:18px 18px 6px 18px; font-weight:600; }
.cb.fresh, .coach-plan.fresh { opacity:0; animation:coach-in var(--dur-slow) var(--ease) forwards; }
@keyframes coach-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
.cb.typing .cb-text { display:flex; gap:5px; padding:16px 16px; }
.cb.typing i { width:8px; height:8px; border-radius:50%; background:var(--muted); animation:coach-dot 1s infinite ease-in-out; }
.cb.typing i:nth-child(2) { animation-delay:.15s; }
.cb.typing i:nth-child(3) { animation-delay:.3s; }
@keyframes coach-dot { 0%, 80%, 100% { opacity:.3; transform:none; } 40% { opacity:1; transform:translateY(-3px); } }
.coach-foot { transition:opacity var(--dur) var(--ease); }
.coach-foot.wait { opacity:0; pointer-events:none; }
.coach-foot .wiz-foot-inner:empty { display:none; }
.coach-foot:has(.wiz-foot-inner:empty) { display:none; }
.coach-chips { display:grid; gap:8px; max-height:44dvh; overflow-y:auto; }
.coach-chips.many { grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); }
.coach-chips.days { grid-template-columns:repeat(7, 1fr); gap:6px; }
.coach-chip { display:grid; gap:2px; padding:12px 14px; text-align:left; border-radius:14px; border:2px solid var(--line); background:var(--card); color:var(--text); box-shadow:0 3px 0 var(--line); }
.coach-chip:active { transform:translateY(3px); box-shadow:none; }
.coach-chip small { color:var(--muted); font-size:13px; }
.coach-chips.days .coach-chip { padding:12px 0; text-align:center; }
.coach-chip.on { border-color:var(--blaze-ink); background:color-mix(in srgb, var(--blaze) 18%, var(--card)); box-shadow:0 3px 0 var(--blaze-edge); }
.coach-row { display:flex; gap:8px; align-items:stretch; }
.coach-row > * { flex:1; }
.coach-row > .primary { flex:none; min-width:96px; }
.coach-row:has(.ghost) > .primary { flex:1; }
.coach-row input#coach-input:not([type=number]) { min-height:48px; }
.coach-form { display:grid; gap:8px; }
.coach-form .error:empty { display:none; }

.coach-plan { display:grid; gap:12px; padding:16px; border-radius:18px; background:var(--card); border:2px solid var(--line); }
.coach-plan header h2 { margin:2px 0 6px; font-size:22px; }
.coach-plan header p { margin:0; color:var(--muted); line-height:1.45; }
.coach-day h3 { display:flex; gap:8px; align-items:baseline; margin:0 0 6px; font-size:16px; }
.coach-day h3 span { font-size:12px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--blaze-ink); min-width:84px; }
.coach-day ol { margin:0; padding:0; list-style:none; display:grid; gap:4px; }
.coach-day li { display:flex; justify-content:space-between; gap:12px; padding:6px 0; border-top:1px solid var(--line); font-size:15px; }
.coach-day li em { flex:none; font-style:normal; color:var(--muted); font-variant-numeric:tabular-nums; }
.coach-note { font-size:13px; margin:12px 0 0; }
.coach-actions { display:grid; gap:8px; margin-top:16px; }
.danger-text { color:var(--bad-text); }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

.coach-promo { display:flex; gap:12px; align-items:center; margin-top:16px; padding:14px; border-radius:18px; border:2px solid var(--line); background:var(--card); }
.coach-promo-art { flex:none; display:flex; align-items:flex-end; }
.coach-promo-art .idle-sprite { height:64px; }
.coach-promo-art .idle-sprite + .idle-sprite { margin-left:-10px; }
.coach-promo-text h2 { margin:0 0 4px; font-size:18px; }
.coach-promo-text p { margin:0 0 10px; color:var(--muted); font-size:14px; line-height:1.4; }
.coach-promo-actions { display:flex; gap:8px; flex-wrap:wrap; }
.coach-promo-actions .ghost { min-height:44px; }

.coach-today { margin-top:16px; padding:14px 16px; border-radius:18px; border:2px solid var(--blaze); background:color-mix(in srgb, var(--blaze) 10%, var(--card)); }
.coach-today.rest { border-color:var(--line); background:var(--card); }
.coach-today header { display:grid; grid-template-columns:1fr auto; align-items:start; }
.coach-today header > :not(.duo-link) { grid-column:1; }
.coach-today .duo-link { grid-column:2; grid-row:1 / span 3; }
.coach-today h2 { margin:2px 0; font-size:20px; }
.coach-today header p { margin:0; color:var(--muted); font-size:14px; }
.coach-ex-list { display:grid; gap:6px; margin-top:12px; }
.coach-ex { display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:12px; border:1px solid var(--line); background:var(--card); color:var(--text); text-align:left; }
.coach-ex-name { flex:1; font-weight:700; }
.coach-ex em { font-style:normal; color:var(--muted); font-variant-numeric:tabular-nums; }
.coach-check { flex:none; display:grid; place-items:center; width:24px; height:24px; border-radius:50%; border:2px solid var(--line); font-size:14px; font-weight:900; color:#fff; }
.coach-ex.done .coach-check { background:var(--ok); border-color:var(--ok); }
.coach-ex.done .coach-ex-name { color:var(--muted); text-decoration:line-through; }

.coach-strip { display:flex; gap:10px; align-items:flex-start; margin:0 0 14px; padding:10px 12px; border-radius:14px; border:2px solid var(--blaze); background:color-mix(in srgb, var(--blaze) 10%, var(--card)); }
.coach-strip img { flex:none; width:36px; height:36px; border-radius:50%; object-fit:contain; background:var(--raised); }
.coach-strip > div { display:grid; gap:2px; }
.coach-strip-k { font-size:12px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--blaze-ink); }
.coach-strip-v { font-size:15px; }
.coach-strip small { color:var(--muted); font-size:13px; }

/* Home's second row of tiles (after "Not now" on the plan card), and the share card screen (share.js). */
.duo-tile.blaze { --c:var(--blaze); --e:var(--blaze-edge); }
.duo-tile.spark { --c:var(--spark); --e:#cca000; }
.duo-tile.share { --c:var(--go); --e:var(--go-edge); }
.duo-tile-icon { display:grid; place-items:center; width:78px; color:var(--go); }
.duo-tile-icon svg { width:52px; height:52px; }
.duo-tiles + .duo-tiles { margin-top:4px; }
.share-preview { display:flex; justify-content:center; margin:4px 0 16px; }
.share-preview canvas { width:100%; max-width:360px; height:auto; aspect-ratio:4 / 5; border-radius:18px; box-shadow:0 10px 30px rgba(0,0,0,.25); background:var(--raised); }
.share-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; max-width:360px; margin:0 auto; }
.share-actions .primary { grid-column:1 / -1; min-height:52px; font-size:17px; }
.share-photo-btn { display:flex; align-items:center; justify-content:center; gap:8px; cursor:pointer; }
.share-link { grid-column:1 / -1; background:none; border:0; padding:8px; color:var(--muted); font-weight:700; text-decoration:underline; }
.share-note { text-align:center; font-size:13px; margin-top:12px; }
#share-error { text-align:center; }

/* ---------- The daily game (public/game.js) ---------- */

/* The flame in the middle of the tab bar: raised, and glowing until today's quests are done. */
#tabbar .tab-flame { overflow:visible; }
#tabbar .flame-btn { display:grid; place-items:center; width:54px; height:54px; margin:-26px 0 -4px; border-radius:50%;
  background:var(--torch); box-shadow:0 4px 0 var(--torch-edge), 0 0 0 4px var(--bg); transition:transform var(--dur) var(--ease); }
#tabbar .flame-btn img { width:40px; height:40px; object-fit:contain; }
#tabbar .tab-flame:active .flame-btn { transform:translateY(3px); box-shadow:0 1px 0 var(--torch-edge), 0 0 0 4px var(--bg); }
#tabbar .tab-flame.active .flame-btn { box-shadow:0 4px 0 var(--torch-edge), 0 0 0 4px var(--bg), 0 0 18px color-mix(in srgb, var(--torch) 60%, transparent); }
#tabbar:has(.tab-flame.active)::before { opacity:0; }
#tabbar.quests-due .flame-btn { animation:flame-glow 2.4s ease-in-out infinite; }
@keyframes flame-glow { 50% { box-shadow:0 4px 0 var(--torch-edge), 0 0 0 4px var(--bg), 0 0 22px color-mix(in srgb, var(--torch) 70%, transparent); } }
@media (prefers-reduced-motion: reduce) { #tabbar.quests-due .flame-btn { animation:none; } }

.duo-top-right { display:flex; align-items:center; gap:8px; }
.duo-avatar { display:grid; place-items:center; width:36px; height:36px; border-radius:50%; border:2px solid var(--line); background:var(--raised); color:var(--text); font-size:13px; font-weight:900; }

/* Home: level and today's quests */
.today-card { margin:16px 0 4px; border:2px solid var(--line); border-radius:20px; background:var(--card); overflow:hidden; }
.today-skel { display:block; height:150px; }
.today-level { display:flex; align-items:center; gap:10px; width:100%; padding:10px 14px; border:0; border-bottom:2px solid var(--line); background:none; color:var(--text); text-align:left; }
.lvl-badge { flex:none; display:grid; place-items:center; width:32px; height:32px; border-radius:10px; background:var(--torch); box-shadow:0 3px 0 var(--torch-edge); color:#fff; font-weight:900; font-size:15px; }
.lvl-badge.big { width:48px; height:48px; border-radius:14px; font-size:22px; }
.lvl-text { flex:1; display:grid; gap:5px; min-width:0; }
.lvl-text b { font-size:14px; }
.lvl-bar { display:block; height:8px; border-radius:4px; background:var(--line); overflow:hidden; }
.lvl-bar i { display:block; height:100%; border-radius:4px; background:var(--torch); transition:width var(--dur-slow) var(--ease); }
.lvl-xp { flex:none; font-size:12px; font-weight:800; color:var(--muted); }
.today-main { display:flex; align-items:center; gap:14px; width:100%; padding:14px; border:0; background:none; color:var(--text); text-align:left; }
.today-ring { --p:0; flex:none; display:grid; place-items:center; width:86px; height:86px; border-radius:50%;
  background:conic-gradient(var(--torch) calc(var(--p) * 360deg), var(--line) 0); }
.today-ring > span { display:grid; place-items:center; width:66px; height:66px; border-radius:50%; background:var(--card); line-height:1.05; }
.today-ring b { font-size:20px; font-weight:900; }
.today-ring small { font-size:11px; font-weight:800; color:var(--muted); }
.today-list { flex:1; display:grid; gap:6px; min-width:0; }
.today-q { display:flex; align-items:center; gap:8px; min-width:0; font-size:14px; font-weight:700; }
.today-q img { flex:none; width:22px; height:22px; object-fit:contain; }
.today-q-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.today-q.done .today-q-name { color:var(--muted); text-decoration:line-through; }
.q-check { flex:none; display:grid; place-items:center; width:20px; height:20px; border-radius:50%; border:2px solid var(--line); font-size:12px; font-weight:900; color:#fff; }
.done > .q-check, .done .q-check { background:var(--ok); border-color:var(--ok); }
.q-check.big { width:30px; height:30px; font-size:16px; }
.today-rest { min-width:0; overflow-wrap:anywhere; font-size:12px; font-weight:700; color:var(--ember-ink, var(--ember)); }
:root[data-theme="light"] { --ember-ink:#0a7bb0; }

/* The Daily Quest screen */
.quest-hero { display:grid; justify-items:center; margin-top:8px; }
.quest-art { position:relative; display:grid; place-items:center; width:180px; height:150px; }
.quest-art::before { content:""; position:absolute; inset:10px 20px; border-radius:50%; background:radial-gradient(color-mix(in srgb, var(--torch) 35%, transparent), transparent 70%); }
.quest-art .idle-sprite { position:relative; height:140px; }
.quest-card { width:100%; margin-top:-6px; padding:16px; border:2px solid var(--line); border-radius:22px; background:var(--card); text-align:center; }
.quest-card h1 { margin:2px 0 4px; font-size:26px; }
.quest-card > p { margin:0 0 14px; color:var(--muted); }
.quest-card > p b { color:var(--accent); }
.quest-list { display:grid; gap:8px; text-align:left; }
.quest { display:flex; align-items:center; gap:10px; padding:10px 12px; border:2px solid var(--line); border-radius:16px; background:var(--bg); }
.quest img { flex:none; width:34px; height:34px; object-fit:contain; }
.quest-main { flex:1; display:grid; gap:4px; min-width:0; }
.quest-main b { font-size:15px; }
.quest-main small { color:var(--muted); font-size:12px; font-weight:700; }
.quest-bar { display:block; height:8px; border-radius:4px; background:var(--line); overflow:hidden; }
.quest-bar i { display:block; height:100%; border-radius:4px; background:var(--qc); }
.quest.done { border-color:color-mix(in srgb, var(--ok) 55%, var(--line)); }
.quest-go { flex:none; min-height:38px; padding:6px 14px; border:2px solid var(--qc); border-radius:12px; background:color-mix(in srgb, var(--qc) 14%, var(--card)); color:var(--text); font-weight:800; box-shadow:0 3px 0 var(--qc); }
.quest-go:active { transform:translateY(3px); box-shadow:none; }
.quest-stats { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:14px; }
.qs-card { display:flex; gap:10px; align-items:center; padding:12px; border:2px solid var(--line); border-radius:18px; background:var(--card); }
.qs-card > div { display:grid; gap:4px; min-width:0; flex:1; }
.qs-card small { color:var(--muted); font-size:12px; font-weight:600; }
.qs-flame { font-size:34px; line-height:1; }
.qs-total { color:var(--accent); }
.xp-lines { display:grid; border:2px solid var(--line); border-radius:16px; background:var(--card); }
.xp-lines div { display:flex; justify-content:space-between; padding:10px 14px; border-bottom:1px solid var(--line); font-weight:600; }
.xp-lines div:last-child { border-bottom:0; }
.xp-lines b { color:var(--accent); }
.xp-week { display:grid; grid-template-columns:repeat(7, 1fr); gap:6px; align-items:end; height:140px; padding:12px; border:2px solid var(--line); border-radius:16px; background:var(--card); margin-bottom:24px; }
.xw { display:grid; grid-template-rows:auto 1fr auto; justify-items:center; gap:4px; height:100%; }
.xw-n { font-size:11px; font-weight:800; color:var(--muted); min-height:14px; }
.xw-bar { position:relative; width:70%; height:100%; display:flex; align-items:flex-end; }
.xw-bar i { display:block; width:100%; min-height:3px; border-radius:6px; background:var(--torch); }
.xw-d { font-size:12px; font-weight:800; color:var(--muted); }
.xw.today .xw-d { color:var(--accent); }
@media (max-width:380px) { .quest-stats { grid-template-columns:1fr; } }

/* Water on Meals */
.water-row { margin:12px 0; padding:12px 14px; border:2px solid var(--line); border-radius:18px; background:var(--card); }
.water-head { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.water-head img { width:26px; height:26px; object-fit:contain; }
.water-head span { margin-left:auto; color:var(--muted); font-size:13px; font-weight:700; }
.water-cups { display:flex; flex-wrap:wrap; gap:6px; }
.cup { position:relative; width:32px; height:40px; padding:0; border:2px solid color-mix(in srgb, var(--ember) 50%, var(--line)); border-radius:4px 4px 10px 10px; background:transparent; overflow:hidden; }
.cup i { position:absolute; left:0; right:0; bottom:0; height:0; background:var(--ember); transition:height var(--dur) var(--ease); }
.cup.full i { height:80%; }
.cup.add { border-style:dashed; color:var(--ember-ink, var(--ember)); font-size:20px; font-weight:900; }

/* Swiping an exercise row left shows Archive and Delete under it */
.item[data-kind="exercise"] { position:relative; overflow:hidden; touch-action:pan-y; --sx:0px; }
.item[data-kind="exercise"] > :not(.swipe-acts) { transform:translateX(var(--sx)); }
.item.swipe-anim > * { transition:transform 220ms var(--ease); }
.swipe-acts { position:absolute; top:0; right:0; bottom:0; width:176px; display:flex; transform:translateX(calc(100% + var(--sx))); }
.swipe-acts button { flex:1; display:grid; place-content:center; justify-items:center; gap:2px; border:0; border-radius:0; color:#fff; font-size:13px; font-weight:800; cursor:pointer; }
.swipe-archive { background:var(--ember); }
.swipe-delete { background:var(--go); }
.swipe-acts button:active { filter:brightness(.92); }
.swipe-tip { margin:14px 4px 0; font-size:13px; text-align:center; }
/* Archived exercises on Workouts, and the banner on an archived exercise */
.archived-box { margin-top:22px; }
.archived-box summary { display:flex; align-items:center; gap:8px; cursor:pointer; list-style:none; font-size:17px; font-weight:800; color:var(--muted); padding:6px 2px; }
.archived-box summary::-webkit-details-marker { display:none; }
.archived-box summary::after { content:"\203A"; margin-left:auto; font-size:22px; transition:transform 160ms; }
.archived-box[open] summary::after { transform:rotate(90deg); }
.archived-box > p { margin:2px 2px 10px; font-size:13px; }
.archived-item { opacity:.92; }
.archived-item .swatch { display:grid; place-items:center; color:var(--muted); }
.restore-btn { flex:none; min-height:36px; padding:6px 14px; border-radius:999px; border:2px solid var(--line); background:var(--card); box-shadow:0 3px 0 var(--line);
  color:var(--text); font-size:13px; font-weight:800; cursor:pointer; }
.restore-btn:active { transform:translateY(3px); box-shadow:none; }
.archived-banner { display:flex; align-items:center; gap:10px; margin:0 0 12px; padding:10px 12px; border-radius:14px; border:2px solid var(--ember);
  background:color-mix(in srgb, var(--ember) 12%, var(--card)); font-size:14px; font-weight:600; }
.archived-banner > span { flex:1; }
.exd-danger { display:grid; gap:8px; margin-top:18px; padding-top:16px; border-top:1px solid var(--line); }
.exd-danger button { display:inline-flex; align-items:center; justify-content:center; gap:8px; }
.exd-danger p { margin:0; font-size:13px; }

/* Cardio targets: in the custom form and settings, and the strip on the log screen */
.exn-targets { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px; padding-right:8px; }
.exn-targets[hidden], .exn-target[hidden] { display:none; }
.exn-target { display:grid; gap:4px; font-size:13px; font-weight:700; color:var(--muted); }
.exn-tin { display:flex; align-items:center; gap:6px; }
.exn-tin input { flex:1; min-width:0; }
.exn-tin em { font-style:normal; font-weight:800; color:var(--text); }
.exn-tin select { width:auto; flex:none; min-height:44px; padding:6px 8px; }
.cardio-target { display:flex; gap:12px; align-items:flex-start; margin-bottom:12px; padding:12px; border-radius:16px; border:2px solid var(--spark);
  background:color-mix(in srgb, var(--spark) 12%, var(--card)); }
.cardio-target.hit { border-color:var(--sizzle); background:color-mix(in srgb, var(--sizzle) 12%, var(--card)); }
.cardio-target .ct-badge { flex:none; width:52px; height:52px; margin:-4px 0 0 -4px; }
.ct-main { flex:1; min-width:0; display:grid; gap:8px; }
.ct-title { font-size:15px; font-weight:800; }
.ct-part { display:grid; grid-template-columns:auto 1fr; align-items:baseline; gap:2px 8px; }
.ct-k { font-size:12px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); }
.ct-v { justify-self:end; font-size:14px; color:var(--muted); }
.ct-v b { color:var(--text); }
.ct-check { color:var(--sizzle); font-weight:900; }
.ct-bar { grid-column:1 / -1; height:8px; border-radius:999px; background:color-mix(in srgb, var(--line) 80%, transparent); overflow:hidden; }
.ct-bar i { display:block; height:100%; border-radius:inherit; background:var(--spark); transition:width 300ms var(--ease); }
.ct-part.done .ct-bar i { background:var(--sizzle); }
.cardio-tile .ct-goal { font-size:12px; font-weight:800; color:#a37f00; }
:root[data-theme="dark"] .cardio-tile .ct-goal { color:var(--spark); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cardio-tile .ct-goal { color:var(--spark); } }

/* ---------- guided workouts (public/session.js) ---------- */
.sess-start { display:grid; grid-template-columns:auto 1fr; align-items:center; column-gap:12px; width:100%; margin:12px 0 4px; padding:12px 16px; text-align:left; }
.sess-start .sess-play { grid-row:span 2; display:grid; place-items:center; width:40px; height:40px; border-radius:50%; background:#fff; color:var(--go); font-size:16px; padding-left:3px; }
.sess-start > span:not(.sess-play) { font-size:17px; font-weight:800; }
.sess-start small { font-size:12px; font-weight:700; opacity:.9; }
.coach-today .sess-start { margin-top:12px; }
.sess-resume .k { color:#fff; opacity:.9; }

.sess-bar { position:sticky; top:0; z-index:5; display:grid; gap:8px; margin:0 0 14px; padding:12px 14px; border-radius:18px;
  border:2px solid var(--torch-edge); background:color-mix(in srgb, var(--torch) 14%, var(--card)); box-shadow:0 4px 0 var(--torch-edge); }
.sess-bar.other { grid-template-columns:1fr auto; align-items:center; font-weight:800; font-size:14px; }
.sess-top { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.sess-title { font-size:13px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sess-chip { flex:none; padding:4px 10px; border-radius:999px; border:2px solid var(--line); background:var(--card); color:var(--text); font-size:12px; font-weight:800; cursor:pointer; }
.sess-dots { display:flex; gap:4px; }
.sess-dots i { flex:1; height:6px; border-radius:999px; background:var(--line); }
.sess-dots i.done { background:var(--sizzle); }
.sess-dots i.later { background:var(--spark); }
.sess-dots i.skipped { background:color-mix(in srgb, var(--muted) 50%, var(--line)); }
.sess-dots i.cur { background:var(--torch); box-shadow:0 0 0 2px color-mix(in srgb, var(--torch) 35%, transparent); }
.sess-now { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 10px; }
.sess-now b { font-size:18px; font-weight:800; }
.sess-now span { font-size:13px; font-weight:700; color:var(--muted); }
.sess-now .sess-resting { color:var(--torch); }
.sess-now .sess-resting:empty { display:none; }
.sess-actions { display:flex; gap:8px; }
.sess-btn { flex:1; min-height:40px; padding:8px 12px; border-radius:14px; border:2px solid var(--line); background:var(--card); box-shadow:0 3px 0 var(--line);
  color:var(--text); font-size:14px; font-weight:800; cursor:pointer; transition:transform 80ms ease, box-shadow 80ms ease; }
.sess-btn:active { transform:translateY(3px); box-shadow:none; }
.sess-btn.primary { background:var(--torch); border-color:var(--torch-edge); box-shadow:0 3px 0 var(--torch-edge); color:#fff; }
.sess-btn.big { min-height:54px; font-size:17px; border-radius:16px; }

/* The rest / up-next screen: not modal, so squad celebrations still show above it */
.rest-dlg { position:fixed; inset:0; z-index:60; width:100%; max-width:none; height:100%; max-height:none; margin:0; padding:16px; border:0;
  background:color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px); color:var(--text); }
.rest-dlg[open] { display:grid; place-items:center; }
.rest-card { position:relative; width:100%; max-width:420px; display:grid; gap:10px; justify-items:center; text-align:center; padding:22px 18px 18px;
  border:2px solid var(--line); border-radius:24px; background:var(--card); box-shadow:0 6px 0 var(--line), 0 20px 50px rgba(0,0,0,.18);
  animation:rise 240ms var(--ease) backwards; max-height:calc(100dvh - 32px); overflow-y:auto; }
.rest-card.up { border-color:var(--sizzle); box-shadow:0 6px 0 var(--sizzle-edge), 0 20px 50px rgba(0,0,0,.18); }
.rest-hide { position:absolute; top:12px; right:12px; padding:4px 10px; border-radius:999px; border:2px solid var(--line); background:var(--card); color:var(--muted); font-size:12px; font-weight:800; cursor:pointer; }
.rest-head { display:flex; align-items:flex-end; justify-content:center; gap:4px; margin-top:22px; }
.rest-art { width:84px; }
.rest-ring { --p:1; position:relative; display:grid; place-items:center; width:150px; height:150px; border-radius:50%;
  background:conic-gradient(var(--torch) calc(var(--p) * 360deg), var(--line) 0); transition:background 250ms linear; }
.rest-ring::before { content:""; position:absolute; inset:12px; border-radius:50%; background:var(--card); }
.rest-ring > span { position:relative; display:grid; }
.rest-ring b { font-size:40px; font-weight:900; font-variant-numeric:tabular-nums; line-height:1; }
.rest-ring small { font-size:12px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
.rest-ring.up { background:var(--sizzle); animation:rest-pulse 1.2s ease-in-out infinite; }
.rest-ring.up b { color:var(--sizzle); }
@keyframes rest-pulse { 50% { transform:scale(1.04); } }
.rest-k { margin:6px 0 0; font-size:12px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); }
.rest-card h2 { margin:0; font-size:26px; font-weight:900; }
.rest-sub { margin:0; font-size:14px; color:var(--muted); }
.rest-next { display:flex; align-items:center; gap:12px; width:100%; padding:12px; border-radius:16px; border:2px solid var(--line); text-align:left; }
.rest-next-art { flex:none; display:grid; place-items:center; width:56px; height:56px; border-radius:14px; background:color-mix(in srgb, var(--torch) 14%, var(--card)); color:var(--torch); }
.rest-next-art svg { width:30px; height:30px; }
.rest-next b { display:block; font-size:18px; font-weight:800; }
.rest-next small { font-size:13px; color:var(--muted); font-weight:600; }
.rest-actions { display:flex; gap:8px; width:100%; }
.rest-actions .big { flex:3; }
.rest-actions.col { flex-direction:column; }
.rest-alt { display:flex; flex-wrap:wrap; justify-content:center; gap:4px 16px; }
.rest-alt .link { font-weight:800; }
.sess-list { display:grid; gap:6px; width:100%; margin:6px 0; }
.sess-row { display:flex; align-items:center; gap:10px; width:100%; padding:10px 12px; border-radius:14px; border:2px solid var(--line); background:var(--card); color:var(--text); text-align:left; cursor:pointer; }
.sess-row.cur { border-color:var(--torch); }
.sess-row.done { opacity:.7; }
.sess-n { flex:none; display:grid; place-items:center; width:28px; height:28px; border-radius:50%; background:var(--line); font-size:13px; font-weight:900; }
.sess-row.done .sess-n { background:var(--sizzle); color:#fff; }
.sess-row.later .sess-n { background:var(--spark); color:#3c3c3c; }
.sess-row-main { display:grid; }
.sess-row-main small { font-size:12px; color:var(--muted); font-weight:600; }
.finish-art { width:140px; }
.finish-stats { display:grid; grid-template-columns:repeat(3, 1fr); gap:8px; width:100%; }
.finish-stats div { display:grid; padding:10px 4px; border-radius:14px; background:color-mix(in srgb, var(--torch) 12%, var(--card)); }
.finish-stats b { font-size:26px; font-weight:900; }
.finish-stats small { font-size:12px; font-weight:700; color:var(--muted); }

/* Squad chat additions, the do-it-yourself builder, Spark's weekly card and Ember on the rest screen */
.coach-title img + img { margin-left:-8px; }
.coach-chips.kinds { display:grid; grid-template-columns:repeat(auto-fill, minmax(92px, 1fr)); gap:8px; }
.coach-chip.art { display:grid; justify-items:center; gap:2px; padding:8px 6px; }
.coach-chip.art img { width:40px; height:40px; }
.coach-promo { position:relative; }
.coach-promo-x { position:absolute; top:6px; right:8px; border:0; background:none; color:var(--muted); font-size:14px; cursor:pointer; padding:6px; }
.coach-promo-art .idle-sprite + .idle-sprite { margin-left:-16px; }
.diy-goals { display:flex; flex-wrap:wrap; gap:8px; margin:4px 0 12px; }
.diy-goal { padding:8px 14px; border-radius:999px; border:2px solid var(--line); background:var(--card); box-shadow:0 3px 0 var(--line); color:var(--text); font-weight:800; font-size:14px; cursor:pointer; }
.diy-goal.on { background:var(--blaze); border-color:var(--blaze-edge); box-shadow:0 3px 0 var(--blaze-edge); color:#fff; }
.diy-tip { display:flex; gap:12px; padding:12px; border-radius:16px; border:2px solid var(--blaze); background:color-mix(in srgb, var(--blaze) 10%, var(--card)); }
.diy-tip img { flex:none; }
.diy-tip p { margin:4px 0 0; font-size:14px; }
.diy-tip .diy-sug { font-weight:700; }
.diy-week { margin-bottom:12px; }
.diy-empty { text-align:center; }
.diy-day { display:grid; gap:8px; margin:12px 0; padding:12px; border-radius:18px; border:2px solid var(--line); background:var(--card); box-shadow:0 4px 0 var(--line); }
.diy-day header { display:grid; gap:6px; }
.diy-wd { font-size:12px; font-weight:800; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); }
.diy-name { font-size:17px; font-weight:800; }
.diy-ex { display:grid; grid-template-columns:1fr auto; gap:6px 8px; align-items:center; padding:10px; border-radius:14px; background:var(--raised); }
.diy-ex-name { font-weight:800; grid-column:1 / 2; }
.diy-ex .icon-btn { grid-column:2; grid-row:1; }
.diy-ex label { display:grid; gap:2px; font-size:11px; font-weight:800; color:var(--muted); text-transform:uppercase; }
.diy-ex label input, .diy-ex label select { min-height:38px; padding:6px 8px; font-size:15px; }
.diy-ex:has(label) { grid-template-columns:repeat(3, minmax(0,1fr)) auto; }
.diy-ex:has(label) .diy-ex-name { grid-column:1 / 4; }
.diy-ex:has(label) .icon-btn { grid-column:4; grid-row:1; }
.diy-ex-cardio { font-size:12px; font-weight:800; color:var(--muted); }
.diy-add { display:grid; grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); gap:8px; }
.spark-week { display:flex; align-items:center; gap:12px; width:100%; margin-top:12px; padding:10px 14px; border-radius:18px; border:2px solid var(--spark);
  background:color-mix(in srgb, var(--spark) 12%, var(--card)); box-shadow:0 4px 0 #cca000; color:var(--text); text-align:left; cursor:pointer; }
.spark-week.done { border-color:var(--sizzle); box-shadow:0 4px 0 var(--sizzle-edge); }
.spark-week img { flex:none; }
.sw-main { flex:1; min-width:0; display:grid; gap:6px; }
.sw-k { font-size:14px; font-weight:800; }
.sw-bar { height:8px; border-radius:999px; background:color-mix(in srgb, var(--line) 80%, transparent); overflow:hidden; }
.sw-bar i { display:block; height:100%; border-radius:inherit; background:var(--spark); transition:width 300ms var(--ease); }
.spark-week.done .sw-bar i { background:var(--sizzle); }
.sw-v { flex:none; font-size:13px; color:var(--muted); font-weight:700; }
.sw-v b { color:var(--text); font-size:16px; }
.rest-ember { display:flex; align-items:center; gap:10px; width:100%; padding:10px 12px; border-radius:14px; border:2px solid var(--ember); background:color-mix(in srgb, var(--ember) 10%, var(--card));
  color:var(--text); font-weight:800; font-size:14px; cursor:pointer; }
@media (max-width:400px) {
  .coach-promo-art .idle-sprite:nth-child(3) { display:none; }
  .coach-title img + img { margin-left:-12px; }
  .coach-title img { width:24px; height:24px; }
}
.coach-title span { white-space:nowrap; }

/* "Rate my routine": Blaze's score card in the chat */
.coach-review { display:grid; gap:8px; margin:6px 0 4px; padding:16px; border-radius:20px; border:2px solid var(--blaze); background:var(--card);
  box-shadow:0 4px 0 var(--blaze-edge); animation:rise 300ms var(--ease) backwards; }
.coach-review header { display:flex; align-items:center; gap:14px; }
.coach-review h3 { margin:2px 0 0; font-size:16px; font-weight:800; line-height:1.3; }
.rv-score { --p:.5; flex:none; position:relative; display:grid; place-content:center; justify-items:center; width:72px; height:72px; border-radius:50%;
  background:conic-gradient(var(--blaze) calc(var(--p) * 360deg), var(--line) 0); }
.rv-score::before { content:""; position:absolute; inset:7px; border-radius:50%; background:var(--card); }
.rv-score b, .rv-score small { position:relative; line-height:1; }
.rv-score b { font-size:26px; font-weight:900; }
.rv-score small { font-size:11px; font-weight:800; color:var(--muted); }
.coach-review h4 { margin:8px 0 0; font-size:12px; font-weight:800; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); }
.rv-good, .rv-fix { margin:0; padding:0; list-style:none; display:grid; gap:6px; }
.rv-good li { position:relative; padding-left:24px; font-size:14px; }
.rv-good li::before { content:"✓"; position:absolute; left:0; top:0; color:var(--sizzle); font-weight:900; }
.rv-fix { counter-reset:fix; }
.rv-fix li { counter-increment:fix; position:relative; display:grid; gap:2px; padding:10px 10px 10px 42px; border-radius:14px; background:color-mix(in srgb, var(--blaze) 9%, var(--card)); font-size:14px; }
.rv-fix li::before { content:counter(fix); position:absolute; left:10px; top:10px; display:grid; place-items:center; width:22px; height:22px; border-radius:50%;
  background:var(--blaze); color:#fff; font-size:12px; font-weight:900; }
.rv-fix b { font-size:15px; }
.rv-cardio { display:flex; gap:10px; align-items:flex-start; margin-top:6px; padding:10px; border-radius:14px; background:color-mix(in srgb, var(--spark) 12%, var(--card)); }
.rv-cardio p { margin:0; font-size:14px; }
.rv-cardio b { display:block; }

/* ---------- profile pictures ---------- */
.avatar { flex:none; display:grid; place-items:center; width:40px; height:40px; border-radius:50%; overflow:hidden; background:var(--flame); color:#fff; font-weight:900; font-size:14px; }
.avatar img { width:100%; height:100%; object-fit:cover; display:block; }
.duo-avatar { padding:0; overflow:hidden; }
.duo-avatar .avatar { width:100%; height:100%; font-size:13px; }
.duo-squad { display:grid; place-items:center; width:36px; height:36px; border-radius:50%; border:2px solid var(--line); background:var(--raised); color:var(--text); cursor:pointer; }
.pf-avatar-pick { position:relative; flex:none; cursor:pointer; border-radius:50%; }
.pf-avatar-pick .avatar.pf-avatar { width:72px; height:72px; font-size:26px; }
.pf-avatar-cam { position:absolute; right:-2px; bottom:-2px; display:grid; place-items:center; width:28px; height:28px; border-radius:50%; background:var(--card); border:2px solid var(--line); color:var(--text); }
.pf-avatar-cam svg { width:15px; height:15px; }
.pf-avatar-pick:focus-within { outline:2px solid var(--accent); outline-offset:3px; }
.pf-avatar-remove { margin-top:4px; font-size:13px; }

/* ---------- Home: first button extras ---------- */
.home-also { display:block; margin:6px auto 0; }

/* ---------- the challenge prompt ---------- */
.ch-where { display:grid; grid-template-columns:1fr 1fr; gap:10px; width:100%; }
.ch-opt { display:grid; justify-items:center; gap:2px; padding:16px 8px; border-radius:18px; border:2px solid var(--line); background:var(--card); box-shadow:0 4px 0 var(--line);
  color:var(--text); cursor:pointer; transition:transform 80ms ease, box-shadow 80ms ease; }
.ch-opt:active { transform:translateY(4px); box-shadow:none; }
.ch-opt span { font-size:34px; }
.ch-opt b { font-size:16px; font-weight:800; }
.ch-opt small { font-size:12px; color:var(--muted); font-weight:600; }

/* ---------- trophy case (Progress) ---------- */
.trophy-case { margin-bottom:14px; padding:14px; border-radius:20px; border:2px solid var(--line); background:var(--card); box-shadow:0 4px 0 var(--line); }
.trophy-case header { display:flex; align-items:baseline; justify-content:space-between; margin-bottom:10px; }
.trophy-case h2 { margin:0; font-size:18px; font-weight:800; }
.trophy-case header span { font-size:13px; font-weight:700; color:var(--muted); }
.trophy-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); gap:8px; }
.trophy { --m:var(--line); --m2:var(--line); display:grid; justify-items:center; gap:2px; padding:12px 8px 10px; text-align:center; border-radius:16px;
  border:2px solid var(--m); background:color-mix(in srgb, var(--m) 14%, var(--card)); }
.trophy b { font-size:13px; font-weight:800; line-height:1.2; }
.trophy small { font-size:11px; color:var(--muted); font-weight:700; }
.trophy-medal { display:grid; place-items:center; width:58px; height:58px; margin-bottom:4px; border-radius:50%;
  background:radial-gradient(circle at 35% 30%, color-mix(in srgb, #fff 55%, var(--m)), var(--m) 60%, var(--m2)); box-shadow:0 3px 0 var(--m2); }
.trophy-medal img { width:44px; height:44px; object-fit:contain; }
.trophy.locked .trophy-medal { filter:grayscale(1); opacity:.45; }
.trophy.bronze { --m:#d9864a; --m2:#a8622f; }
.trophy.silver { --m:#b9c2cc; --m2:#8a949e; }
.trophy.gold { --m:#ffc800; --m2:#cc9a00; }
.trophy.platinum { --m:#7fd6e8; --m2:#4aa9bd; }
.trophy.diamond { --m:#ce82ff; --m2:#a568cc; }
.trophy-bar { width:100%; height:6px; margin-top:4px; border-radius:999px; background:color-mix(in srgb, var(--line) 80%, transparent); overflow:hidden; }
.trophy-bar i { display:block; height:100%; border-radius:inherit; background:var(--m2); }
.trophy.locked .trophy-bar i { background:var(--muted); }

/* ---------- the squad zone ---------- */
.sq-card { display:flex; align-items:center; gap:12px; width:100%; margin-bottom:14px; padding:10px 14px; border-radius:18px; border:2px solid var(--spark);
  background:color-mix(in srgb, var(--spark) 12%, var(--card)); box-shadow:0 4px 0 #cca000; color:var(--text); text-align:left; cursor:pointer; }
.sq-card-art { flex:none; display:flex; align-items:flex-end; }
.sq-card-art .idle-sprite { height:52px; }
.sq-card-art .idle-sprite + .idle-sprite { margin-left:-12px; }
.sq-card > span:nth-child(2) { flex:1; display:grid; }
.sq-card small { font-size:13px; color:var(--muted); font-weight:600; }
.sq-code { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 16px; border-radius:20px; border:2px solid var(--torch-edge);
  background:color-mix(in srgb, var(--torch) 12%, var(--card)); box-shadow:0 4px 0 var(--torch-edge); }
.sq-code-v { display:block; margin-top:2px; font-size:32px; font-weight:900; letter-spacing:.18em; font-variant-numeric:tabular-nums; }
.sq-code .sess-btn { flex:none; }
.sq-add { display:flex; gap:8px; margin-top:12px; }
.sq-add input { flex:1; min-width:0; text-transform:uppercase; letter-spacing:.12em; font-weight:800; }
.sq-friends, .sq-feed { display:grid; gap:8px; }
.sq-friend, .sq-item { display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:16px; border:2px solid var(--line); background:var(--card); }
.sq-friend-main, .sq-item-main { flex:1; min-width:0; display:grid; gap:1px; }
.sq-friend-main small, .sq-item-main small { font-size:12px; color:var(--muted); font-weight:600; }
.sq-item-main p { margin:0; font-size:14px; }
.sq-ago { font-size:11px !important; }
.sq-cheer { flex:none; display:inline-flex; align-items:center; gap:4px; min-width:52px; justify-content:center; padding:6px 10px; border-radius:999px;
  border:2px solid var(--line); background:var(--card); font-size:16px; cursor:pointer; filter:grayscale(1); }
.sq-cheer span { font-size:13px; font-weight:800; color:var(--text); filter:none; }
.sq-cheer.on { filter:none; border-color:var(--torch); background:color-mix(in srgb, var(--torch) 14%, var(--card)); }
