/* Layout: one phone-width column under a floating glass tab bar.
   Look: deep indigo night, cards that glow at the rim and fall dark in the middle,
   dot-matrix numerals. Day colours: ember = Push, indigo = Pull, magenta = Legs
   (colour-blind checked against the card surface). One deliberate dark theme. */
@font-face {
  font-family: 'Outfit';
  src: url('fonts/outfit-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Doto';
  src: url('fonts/doto-latin.woff2?v=2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --night: #07061a;
  --core: #0b0a24;
  --surface: #0e0d24;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-2: rgba(255, 255, 255, 0.1);
  --ink: #f4f3ff;
  --ink-2: #c4c0ec;
  --muted: #9895c8;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --indigo: #4c47d6;
  --push: #e8592f;
  --pull: #5a6cf5;
  --legs: #d95bb0;
  --accent: #cbe95c;
  --up: #6fe0a4;
  --down: #ff9b6e;
  --danger: #ff6b6b;

  --day: var(--indigo);
  /* Darker shade of the day colour: white text on it stays above 4.5:1. */
  --deep: color-mix(in srgb, var(--day) 80%, #000);
  --deeper: color-mix(in srgb, var(--day) 62%, #000);
  --glow: #2c2596;

  --font: 'Outfit', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --dots: 'Doto', 'Outfit', ui-monospace, monospace;
  --dot-shape: 'ROND' 100;
  --r-xl: 34px;
  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 13px;
  --tabbar: 66px;
  color-scheme: dark;
}

.t-push, .t-pull, .t-legs, .glow, .card { --deep: color-mix(in srgb, var(--day) 80%, #000); --deeper: color-mix(in srgb, var(--day) 62%, #000); }
.t-push { --day: var(--push); }
.t-pull { --day: var(--pull); }
.t-legs { --day: var(--legs); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--night); color: var(--ink); }
body {
  font: 400 16px/1.42 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}
/* The night sky behind everything; its top glow takes the colour of the day in a session. */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(110% 55% at 50% -12%, color-mix(in srgb, var(--glow) 85%, transparent) 0%, transparent 70%),
    radial-gradient(80% 45% at 110% 105%, rgba(217, 91, 176, 0.16), transparent 70%),
    radial-gradient(70% 40% at -20% 70%, rgba(90, 108, 245, 0.14), transparent 70%),
    var(--night);
  transition: background 0.4s ease;
}
body.g-push { --glow: #8a2c1c; }
body.g-pull { --glow: #2c3aa8; }
body.g-legs { --glow: #7c2a6a; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--tabbar) + 48px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 26px;
  animation: enter 0.28s ease-out;
}
#app.no-tabs { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 120px); }
@keyframes enter { from { opacity: 0.35; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.num { font-variant-numeric: tabular-nums; }
.dots { font-family: var(--dots); font-variation-settings: var(--dot-shape); font-weight: 800; letter-spacing: 0.02em; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }

.label { font-size: 13px; font-weight: 400; letter-spacing: 0.01em; color: var(--muted); }
h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: 500; }
.title { font-size: 34px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.05; }
h2 { font-size: 21px; letter-spacing: -0.01em; }
h3 { font-size: 18px; letter-spacing: -0.01em; }

/* ---------- headers ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 4px; }
.page-head > div { display: grid; gap: 4px; min-width: 0; }
.nav-head { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.nav-head .grow { flex: 1; min-width: 0; display: grid; gap: 1px; }
.back {
  width: 42px; height: 42px; flex: none;
  border: 0; border-radius: 50%;
  background: var(--glass); box-shadow: inset 0 0 0 1px var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  display: grid; place-items: center;
}
.back svg { width: 20px; height: 20px; }

/* ---------- surfaces ---------- */
/* Neutral card: a faint indigo rim fading to a dark core. */
.card {
  position: relative;
  border-radius: var(--r-lg);
  background:
    radial-gradient(130% 110% at 50% 30%, rgba(11, 10, 36, 0.93) 38%, rgba(11, 10, 36, 0.35) 100%),
    linear-gradient(180deg, #4640c4 0%, #1e1b6e 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 30px 60px -40px rgba(76, 71, 214, 0.6);
}
/* Feature card: the day colour glows hard at the rim, the centre stays dark. */
.glow {
  position: relative;
  border-radius: var(--r-xl);
  /* Text sits on the dark upper part; the bright glow stays at the bottom edge and a thin rim. */
  background:
    radial-gradient(80% 50% at 50% 108%, color-mix(in srgb, var(--day) 55%, transparent) 0%, transparent 100%),
    radial-gradient(60% 45% at -5% 105%, color-mix(in srgb, var(--day) 30%, transparent), transparent 100%),
    radial-gradient(60% 45% at 105% 105%, color-mix(in srgb, var(--day) 30%, transparent), transparent 100%),
    linear-gradient(180deg, color-mix(in srgb, var(--day) 18%, var(--core)) 0%, var(--core) 45%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 0 0 1px color-mix(in srgb, var(--day) 45%, transparent),
    inset 0 0 26px -6px color-mix(in srgb, var(--day) 70%, transparent),
    0 40px 80px -40px color-mix(in srgb, var(--day) 70%, transparent);
}
.group { display: grid; gap: 12px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 6px; }

.notice {
  padding: 16px 18px;
  font-size: 15px;
  color: var(--ink-2);
}
.notice b { color: var(--ink); font-weight: 500; }

/* ---------- buttons ---------- */
.cta {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 60px; padding: 0 64px;
  border: 0; border-radius: 999px;
  font-size: 17px; font-weight: 500; letter-spacing: 0.005em;
  color: #fff;
  background: linear-gradient(180deg, var(--deep), var(--deeper));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 18px 40px -18px var(--day);
  transition: transform 0.12s ease;
}
.cta-ic {
  position: absolute; right: 7px; top: 7px; bottom: 7px; aspect-ratio: 1;
  border-radius: 50%; background: #fff; color: #0b0a24;
  display: grid; place-items: center;
}
.cta-ic svg { width: 20px; height: 20px; }
.cta.glass { background: var(--glass-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 0 0 1px var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border: 0; border-radius: 999px;
  font-weight: 500; font-size: 16px;
  background: var(--glass); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform 0.12s ease;
}
.btn-day {
  color: #fff;
  background: linear-gradient(180deg, var(--deep), var(--deeper));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 10px 26px -12px var(--day);
}
.btn-light { background: #fff; color: #0b0a24; box-shadow: none; }
.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px currentColor; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn-block { width: 100%; }
.text-btn { border: 0; background: none; padding: 8px 0; color: var(--muted); font-weight: 400; font-size: 15px; }
.cta:active, .btn:active, .back:active, .chip:active, .tab:active, .tick:active { transform: scale(0.97); }

/* ---------- Today: hero ---------- */
.hero { padding: 22px 22px 22px; display: grid; gap: 20px; overflow: hidden; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font-size: 13px; font-weight: 500;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--day); flex: none; display: inline-block; box-shadow: 0 0 10px var(--day); }
.pill .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.hero-name { display: grid; justify-items: center; gap: 6px; padding: 8px 0 2px; text-align: center; }
.hero-name .word {
  font-family: var(--dots); font-variation-settings: var(--dot-shape);
  font-size: 76px; line-height: 0.9;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 0 24px color-mix(in srgb, var(--day) 60%, transparent);
}
.variant {
  display: inline-flex; align-items: center; justify-content: center;
  height: 28px; padding: 0 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font-size: 13px; font-weight: 500; letter-spacing: 0.02em;
}
.hero-meta { display: grid; justify-items: center; gap: 2px; text-align: center; color: var(--ink-2); font-size: 14.5px; }
.hero-meta b { color: var(--ink); font-weight: 500; font-size: 17px; }

.plan { margin: 0; padding: 0; list-style: none; display: grid; }
.plan li {
  display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: baseline;
  padding: 11px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  font-size: 15.5px;
}
.plan li:first-child { border-top: 0; }
.plan .i { font-family: var(--dots); font-variation-settings: var(--dot-shape); font-weight: 800; font-size: 13px; color: var(--muted); }
.plan .sx { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan .w { color: var(--ink); font-weight: 500; }

/* day picker */
.days { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chip {
  position: relative;
  border: 0; border-radius: var(--r-md);
  padding: 13px 12px 12px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--line);
  display: grid; gap: 3px; text-align: left;
  transition: box-shadow 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.chip b { font-size: 16px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.chip span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip[aria-pressed="true"] {
  background: linear-gradient(180deg, color-mix(in srgb, var(--day) 30%, transparent), color-mix(in srgb, var(--day) 8%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--day) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.chip .next-tag { position: absolute; top: 10px; right: 10px; font-size: 11px; color: var(--accent); }

/* week strip */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; padding: 16px 14px; }
.wd { display: grid; justify-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.wd i {
  width: 100%; max-width: 36px; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 1.2px, transparent 1.6px) center / 7px 7px, rgba(255, 255, 255, 0.03);
  display: grid; place-items: center; font-style: normal; font-weight: 500; font-size: 13px;
}
.wd i.on {
  background: radial-gradient(circle at 50% 25%, var(--deep), var(--deeper) 80%);
  box-shadow: 0 0 16px -2px var(--day);
  color: #fff;
}
.wd.today { color: var(--ink); }
.wd.today i:not(.on) { box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ---------- lists ---------- */
.list { display: grid; overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 18px;
  border: 0; background: none; width: 100%; text-align: left;
  position: relative;
}
.row + .row::before { content: ''; position: absolute; top: 0; left: 18px; right: 18px; border-top: 1px dashed rgba(255, 255, 255, 0.09); }
.row.has-badge + .row.has-badge::before { left: 70px; }
button.row:active { background: var(--glass); }
.row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-main b { font-weight: 500; }
.row-side { color: var(--muted); font-size: 14px; white-space: nowrap; text-align: right; display: grid; gap: 2px; justify-items: end; }
.chev { width: 16px; height: 16px; color: var(--muted); flex: none; opacity: 0.6; }
.badge {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 50% 25%, var(--deep), var(--deeper) 80%);
  box-shadow: 0 0 18px -4px var(--day), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 15px;
}
.empty { padding: 24px 18px; color: var(--muted); font-size: 15px; display: grid; gap: 4px; }
.empty b { color: var(--ink); font-weight: 500; }

/* ---------- session ---------- */
.session-head {
  position: sticky; top: 0; z-index: 6;
  margin: calc(-16px - env(safe-area-inset-top, 0px)) calc(-1 * max(16px, env(safe-area-inset-left, 0px))) 0;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, rgba(7, 6, 26, 0.9), rgba(7, 6, 26, 0.65));
  -webkit-backdrop-filter: saturate(1.4) blur(20px);
  backdrop-filter: saturate(1.4) blur(20px);
}
.session-head .nav-head { padding-bottom: 12px; }
.session-head h2 { display: flex; align-items: center; gap: 9px; }
.clock { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress {
  height: 2px; margin: 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 2px, transparent 2px 6px);
}
.progress span { display: block; height: 100%; background: var(--day); box-shadow: 0 0 10px var(--day); transition: width 0.3s ease; }

.ex { padding: 18px; display: grid; gap: 14px; }
.ex.complete {
  background:
    radial-gradient(140% 120% at 50% 35%, rgba(11, 10, 36, 0.92) 45%, rgba(11, 10, 36, 0.4) 100%),
    linear-gradient(180deg, color-mix(in srgb, var(--day) 70%, #fff 10%), color-mix(in srgb, var(--day) 60%, #000));
}
.ex-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ex-title { border: 0; background: none; padding: 0; text-align: left; display: grid; gap: 3px; min-width: 0; }
.ex-title h3 { display: flex; align-items: center; gap: 6px; }
.ex-title h3 svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.ex-count {
  font-family: var(--dots); font-variation-settings: var(--dot-shape); font-weight: 800; font-size: 14px;
  height: 28px; min-width: 44px; padding: 0 10px; border-radius: 999px;
  background: var(--glass); box-shadow: inset 0 0 0 1px var(--line);
  display: grid; place-items: center; white-space: nowrap; color: var(--ink-2);
}
.ex.complete .ex-count { background: var(--deep); color: #fff; box-shadow: 0 0 14px -2px var(--day); }

.target {
  display: grid; gap: 5px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 0 0 1px var(--line);
}
.target-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.target-val { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tag {
  font-size: 12px; font-weight: 500;
  height: 26px; padding: 0 10px; border-radius: 999px; background: var(--glass-2); color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 5px;
}
.tag svg { width: 12px; height: 12px; }
.tag.increase { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tag.deload { color: var(--down); background: color-mix(in srgb, var(--down) 14%, transparent); }
.target p { margin: 0; font-size: 13.5px; color: var(--muted); }

.sets { display: grid; gap: 8px; }
.set-labels, .set {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr) 54px 50px;
  gap: 8px;
  align-items: center;
}
.set-labels { font-size: 12px; color: var(--muted); }
.set-labels span { text-align: center; }
.set-n { font-family: var(--dots); font-variation-settings: var(--dot-shape); font-weight: 800; color: var(--muted); text-align: center; font-size: 15px; }
.field {
  width: 100%; min-width: 0;
  height: 50px; padding: 0 8px;
  border: 0; border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 20px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center;
  -webkit-appearance: none; appearance: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.field::placeholder { color: var(--muted); opacity: 1; font-weight: 400; }
.field:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--day), 0 0 18px -6px var(--day); background: rgba(255, 255, 255, 0.09); }
.delta { font-size: 12px; font-weight: 500; text-align: center; line-height: 1.2; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.same { color: var(--muted); font-weight: 400; }
.tick {
  width: 50px; height: 50px; border-radius: 50%; border: 0;
  background: var(--glass); color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
  display: grid; place-items: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.tick svg { width: 22px; height: 22px; }
.set.done .tick {
  background: radial-gradient(circle at 50% 25%, var(--deep), var(--deeper) 80%);
  color: #fff;
  box-shadow: 0 0 20px -4px var(--day), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.set.done .field { background: transparent; color: var(--ink-2); }
.set-actions { display: flex; gap: 8px; }
.set-actions button {
  flex: 1; min-height: 40px; border: 0; border-radius: 999px;
  background: none; box-shadow: inset 0 0 0 1px var(--line);
  font-size: 14px; color: var(--ink-2);
}
.last { font-size: 13.5px; color: var(--muted); padding: 0 2px; }
.last b { color: var(--ink-2); font-weight: 500; }

.confirm { display: grid; gap: 12px; padding: 18px; border-radius: var(--r-md); background: rgba(255, 107, 107, 0.06); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 60%, transparent); }
.confirm b { font-weight: 500; }
.confirm p { margin: 0; color: var(--muted); font-size: 15px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- rest timer ---------- */
.rest {
  position: fixed; z-index: 20;
  left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  max-width: 536px; margin: 0 auto;
  border-radius: 999px;
  padding: 8px 8px 8px 24px;
  background: linear-gradient(180deg, rgba(40, 36, 120, 0.85), rgba(14, 12, 44, 0.92));
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 0 0 1px var(--line), 0 20px 50px -16px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.rest-in { display: flex; align-items: center; gap: 8px; position: relative; }
.rest-time { font-family: var(--dots); font-variation-settings: var(--dot-shape); font-size: 36px; font-weight: 800; line-height: 1; flex: 1; letter-spacing: 0.04em; }
.rest-time small { font-family: var(--font); font-size: 13px; font-weight: 400; color: var(--ink-2); margin-left: 10px; letter-spacing: 0; }
.rest button {
  min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px;
  background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 500; font-size: 15px;
}
.rest button.x { width: 44px; padding: 0; background: #fff; color: #0b0a24; display: grid; place-items: center; }
.rest button.x svg { width: 16px; height: 16px; }
.rest.over { background: linear-gradient(180deg, #5f7a1d, #2c3a0c); }
.rest-bar { position: absolute; left: 24px; right: 24px; bottom: 0; height: 2px; }
.rest-bar span { display: block; height: 100%; background: var(--accent); box-shadow: 0 0 8px var(--accent); transform-origin: left; }

/* ---------- tab bar ---------- */
.tabs {
  position: fixed; z-index: 10;
  left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  max-width: 420px; margin: 0 auto;
  padding: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(46, 42, 130, 0.72), rgba(16, 14, 50, 0.82));
  -webkit-backdrop-filter: saturate(1.5) blur(22px);
  backdrop-filter: saturate(1.5) blur(22px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 0 1px var(--line), 0 20px 50px -18px rgba(0, 0, 0, 0.8);
}
.tabs-in { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.tab {
  border: 0; background: none;
  min-height: 52px; border-radius: 999px;
  display: grid; justify-items: center; align-content: center; gap: 2px;
  color: var(--muted);
  font-size: 11px; font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}
.tab svg { width: 23px; height: 23px; }
.tab[aria-current="page"] { color: var(--ink); background: rgba(255, 255, 255, 0.12); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.live {
  position: fixed; z-index: 9;
  left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--tabbar) + 22px);
  max-width: 420px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 7px 7px 18px;
  border: 0; border-radius: 999px;
  color: #fff;
  background: linear-gradient(180deg, var(--deep), var(--deeper));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 16px 36px -14px var(--day);
  font-weight: 500; font-size: 15px; text-align: left;
}
.live .grow { flex: 1; min-width: 0; }
.live .clock { color: inherit; opacity: 0.8; margin-left: 8px; }
.live .go { padding: 8px 14px; border-radius: 999px; background: #fff; color: #0b0a24; font-size: 14px; }

/* ---------- stats & charts ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { padding: 16px 14px 15px; display: grid; gap: 8px; align-content: start; border-radius: 22px; }
.tile.glow { border-radius: 22px; }
.tile .v { font-family: var(--dots); font-variation-settings: var(--dot-shape); font-size: 38px; font-weight: 800; letter-spacing: 0.02em; line-height: 1; white-space: nowrap; }
.tile .v small { font-family: var(--font); font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.tile .k { font-size: 12.5px; color: var(--ink-2); line-height: 1.25; }
.chg { font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); }
.chg i { font-style: normal; font-size: 9px; }
.chg.up i { color: var(--up); }
.chg.down i { color: var(--down); }

.chart-card { padding: 18px 18px 14px; display: grid; gap: 14px; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 12px; flex-wrap: wrap; }
.chart-head .ttl { display: grid; gap: 2px; min-width: 0; }
.chart-head .legend { flex-basis: 100%; }
.readout { font-size: 13.5px; color: var(--ink-2); min-height: 20px; font-variant-numeric: tabular-nums; }
.readout b { color: var(--ink); font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--day); display: inline-block; box-shadow: 0 0 8px var(--day); }
.chart-svg { width: 100%; height: auto; overflow: visible; }
.chart-svg .grid { stroke: rgba(255, 255, 255, 0.16); stroke-width: 1.2; stroke-dasharray: 0.1 5; stroke-linecap: round; }
.chart-svg .base { stroke: rgba(255, 255, 255, 0.22); stroke-width: 1.4; stroke-dasharray: 0.1 4; stroke-linecap: round; }
.chart-svg .tick { fill: var(--muted); font-size: 10.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart-svg .tick.now { fill: var(--ink); font-weight: 500; }
.chart-svg .hit { cursor: pointer; }
.chart-svg .hit.active path, .chart-svg .hit.active rect[fill^="var(--"] { filter: brightness(1.18) drop-shadow(0 0 6px rgba(255, 255, 255, 0.25)); }
.chart-svg .hit.active .pt { r: 6; }
.chart-svg .hit.active > rect:first-child { fill: rgba(255, 255, 255, 0.05); }
.spark { width: 72px; height: 28px; flex: none; }
.spark .grid { stroke: var(--line-strong); stroke-dasharray: 0.1 4; stroke-linecap: round; stroke-width: 1.4; }

.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px var(--line); }
.seg button { border: 0; background: none; min-height: 36px; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--muted); }
.seg button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.14); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14); }

/* muscle bars */
.mbars { display: grid; gap: 11px; }
.mbar { display: grid; grid-template-columns: 84px minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: 14px; }
.mbar .n { color: var(--ink-2); }
.mbar .val { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.track { position: relative; height: 10px; border-radius: 5px; background: radial-gradient(circle, rgba(255, 255, 255, 0.16) 1px, transparent 1.4px) left center / 6px 10px repeat-x; }
.track .band { position: absolute; top: -4px; bottom: -4px; border-radius: 7px; background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent); }
.track .fill { z-index: 1; position: absolute; left: 0; top: 1px; bottom: 1px; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 45%, transparent), var(--accent)); box-shadow: 0 0 10px -2px var(--accent); min-width: 3px; }
.track .planmark { z-index: 2; position: absolute; top: -5px; bottom: -5px; width: 2px; border-radius: 1px; background: #fff; opacity: 0.7; }
.mlegend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.mlegend span { display: inline-flex; align-items: center; gap: 7px; }
.mlegend .sw-band { width: 16px; height: 10px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.mlegend .sw-fill { width: 16px; height: 6px; border-radius: 3px; background: var(--accent); }
.mlegend .sw-plan { width: 2px; height: 12px; background: #fff; opacity: 0.7; }

/* consistency calendar: one dot per day */
.cal { display: grid; grid-template-columns: 16px repeat(var(--weeks), minmax(0, 1fr)); gap: 5px; }
.cal .dl { font-size: 10px; color: var(--muted); display: grid; place-items: center; }
.cal .c {
  aspect-ratio: 1; border-radius: 50%; border: 0; padding: 0;
  background: rgba(255, 255, 255, 0.05);
  display: grid; place-items: center; font-size: 9.5px; font-weight: 600; color: #fff;
}
.cal .c.on { background: radial-gradient(circle at 50% 25%, var(--deep), var(--deeper) 80%); box-shadow: 0 0 10px -3px var(--day); }
.cal .c.future { background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05); }
.cal .c.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal .c.active { outline: 1.5px solid #fff; outline-offset: 2px; }

/* lifts */
.lift-row .val { font-family: var(--dots); font-variation-settings: var(--dot-shape); font-weight: 700; font-size: 18px; color: var(--ink); }

/* summary */
.done-hero { padding: 26px 22px 24px; display: grid; justify-items: center; gap: 10px; text-align: center; }
.done-hero .word { font-family: var(--dots); font-variation-settings: var(--dot-shape); font-weight: 700; font-size: 58px; line-height: 0.95; letter-spacing: 0.04em; text-transform: uppercase; text-shadow: 0 0 24px color-mix(in srgb, var(--day) 60%, transparent); }
.done-hero .label { color: var(--ink-2); }
.hero-top .small { color: var(--ink-2); }
.pr-card { padding: 18px; display: grid; gap: 10px; }
.pr-card h3 { display: flex; align-items: center; gap: 9px; }
.pr-card h3 svg { width: 19px; height: 19px; color: var(--accent); }
.pr-item { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; color: var(--ink-2); }
.pr-item b { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }
.cmp { display: grid; gap: 2px; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.cmp .was { color: var(--muted); font-size: 13px; }
.arrow { font-size: 11px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--glass); flex: none; }
.arrow.up { color: var(--up); }
.arrow.down { color: var(--down); }
.arrow.same { color: var(--muted); }

/* settings */
.form { display: grid; overflow: hidden; }
.form label { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 18px; position: relative; font-size: 15.5px; }
.form label + label::before { content: ''; position: absolute; top: 0; left: 18px; right: 18px; border-top: 1px dashed rgba(255, 255, 255, 0.09); }
.form .field { width: 92px; flex: none; height: 40px; font-size: 17px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; }
.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding-top: 4px; margin: 0; }

.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 12px); transform: translateX(-50%);
  z-index: 30; padding: 11px 18px; border-radius: 999px;
  background: #fff; color: #0b0a24;
  font-weight: 500; font-size: 15px; max-width: calc(100% - 32px); box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
}

@media (max-width: 370px) {
  .hero-name .word { font-size: 62px; }
  .tile .v { font-size: 25px; }
  .set-labels, .set { grid-template-columns: 18px minmax(0, 1fr) minmax(0, 1fr) 48px 46px; gap: 6px; }
  .tick { width: 46px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { transition: none !important; animation: none !important; }
}
