:root {
  --bg: #eef0ec;
  --card: #ffffff;
  --text: #111311;
  --muted: #5c625b;
  --line: #e1e4dd;
  --chip: #eef0ec;
  --ring: #d3d8cf;

  /* Dark surfaces (header and focus mode) */
  --ink: #111311;
  --ink-2: #1e211d;
  --ink-3: #2b2f2a;
  --ink-line: #3a3f39;
  --on-ink: #f3f5ef;
  --on-ink-muted: #a3aa9f;

  /* Change this one colour to re-theme the page */
  --accent: #d4f24a;
  --on-accent: #111311;

  --display: "Space Grotesk", system-ui, sans-serif;
  --body: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--body);
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}
body.locked { overflow: hidden; }
button { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Header ─────────────────────────────────────────── */
.hero {
  background: var(--ink);
  color: var(--on-ink);
  border-radius: 0 0 32px 32px;
  padding: calc(20px + env(safe-area-inset-top)) 20px 24px;
}
.hero-inner { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--on-ink-muted); }
.reset {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; margin-right: -12px;
  background: none; border: 0; color: #c9cfc5; font-size: 13px; cursor: pointer;
}
.reset svg { width: 16px; height: 16px; }

.hero h1 { font-family: var(--display); font-size: 40px; line-height: 1.02; font-weight: 700; letter-spacing: -.03em; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -20px; padding: 0 20px; scrollbar-width: none; }
.tabs:empty { display: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: flex; align-items: center; min-height: 36px; padding: 0 14px;
  border-radius: 999px; background: var(--ink-2); color: var(--on-ink); text-decoration: none; font-size: 14px;
}
.tab[aria-current="true"] { background: var(--on-ink); color: var(--ink); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--ink-2); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--display); font-size: 22px; font-weight: 600; }
.stat span { font-size: 12px; color: var(--on-ink-muted); }

.progress { display: flex; flex-direction: column; gap: 8px; }
.progress-row { display: flex; justify-content: space-between; font-size: 13px; color: #c9cfc5; }
.progress-row strong { color: var(--on-ink); font-weight: 600; }
.bar { height: 8px; border-radius: 99px; background: var(--ink-3); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s; }

.start {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px;
  border: 0; border-radius: 18px; background: var(--accent); color: var(--on-accent);
  font-weight: 600; font-size: 16px; cursor: pointer;
}
.start svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }

/* ── Plan ───────────────────────────────────────────── */
main { max-width: 680px; margin: 0 auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 28px; }
.intro { color: var(--muted); font-size: 15px; line-height: 1.5; }
.footnote { text-align: center; font-size: 13px; color: var(--muted); }

.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.section-title { display: flex; align-items: center; gap: 10px; }
.section-num { font-family: var(--display); font-size: 13px; font-weight: 600; color: var(--muted); }
.section-head h2 { font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.section-head .meta { font-size: 13px; color: var(--muted); }

.superset {
  display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 26px;
  background: color-mix(in srgb, var(--c) 14%, var(--card));
}
.superset-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 4px; font-size: 12px; color: var(--muted); }
.superset-label b { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.superset-label svg { width: 16px; height: 16px; }

/* ── Exercise card ──────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; transition: opacity .2s; }
.card.done { opacity: .6; }
.card.done .name { text-decoration: line-through; }

.row { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; }
.no {
  flex: none; min-width: 38px; height: 38px; padding: 0 4px; border-radius: 12px; background: var(--chip);
  display: grid; place-items: center; font-family: var(--display); font-size: 14px; font-weight: 600;
}
.main {
  flex: 1; min-width: 0; min-height: 48px; padding: 4px 0; background: none; border: 0; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
}
.main:disabled { cursor: default; }
.name { font-weight: 600; font-size: 16px; line-height: 1.25; }
.details { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--muted); }
.details > span { display: flex; align-items: center; gap: 4px; }
.details svg { width: 13px; height: 13px; stroke-width: 2.2; }
.dose { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.details .target {
  padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; color: var(--text);
  background: color-mix(in srgb, var(--c) 16%, var(--card));
}
.has-media { font-weight: 600; color: var(--text); }
.details .has-media svg { fill: currentColor; stroke: none; }

.check {
  flex: none; width: 44px; height: 44px; border-radius: 50%; padding: 0;
  border: 2px solid var(--ring); background: none; cursor: pointer; display: grid; place-items: center; color: var(--on-accent);
}
.check svg { width: 20px; height: 20px; stroke-width: 3; opacity: 0; }
.card.done .check { background: var(--accent); border-color: var(--accent); }
.card.done .check svg { opacity: 1; }

.body { display: none; padding: 0 12px 12px; }
.card.open .body { display: flex; flex-direction: column; gap: 10px; }
.notes { font-size: 14px; line-height: 1.5; color: var(--muted); white-space: pre-line; }

.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -12px; padding: 0 12px; }
.gallery img {
  flex: none; width: 100%; max-height: 420px; object-fit: cover;
  border-radius: 14px; scroll-snap-align: center; background: var(--chip);
}
.gallery.multi img { width: 85%; }

.video { position: relative; border-radius: 14px; overflow: hidden; background: #000; }
.video.embed { aspect-ratio: 16 / 9; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video video { display: block; width: 100%; max-height: 70vh; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ── Focus mode ─────────────────────────────────────── */
.focus {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  background: var(--ink); color: var(--on-ink);
}
.focus[hidden] { display: none; }
.focus-inner {
  max-width: 560px; min-height: 100%; margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 20px;
}
.focus-top { display: flex; align-items: center; justify-content: space-between; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; color: var(--on-ink);
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; }
.focus-top .icon-btn { margin-left: -10px; }
.focus-section { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #c9cfc5; }
.focus-section .dot { background: color-mix(in srgb, var(--c) 75%, #fff); }
.focus-pos { min-width: 44px; text-align: right; font-family: var(--display); font-size: 15px; font-weight: 600; }

.segs { display: flex; gap: 4px; }
.segs span { flex: 1; height: 4px; border-radius: 99px; background: var(--ink-3); }
.segs .past { background: var(--accent); }
.segs .now { background: var(--on-ink); }

.focus .gallery { margin: 0; padding: 0; }
.focus .gallery img, .focus .video { border-radius: 22px; }

.focus-head { display: flex; flex-direction: column; gap: 10px; }
.pill { align-self: flex-start; padding: 4px 10px; border-radius: 99px; background: var(--ink-3); font-size: 12px; font-weight: 600; color: #dde2d8; }
.focus-head h2 { font-family: var(--display); font-size: 32px; line-height: 1.08; font-weight: 700; letter-spacing: -.02em; }
.focus-target { font-size: 14px; color: var(--on-ink-muted); }
.focus-target b { color: var(--on-ink); font-weight: 500; }
.focus .notes { color: #c9cfc5; font-size: 15px; }

.focus-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.focus-stats div { background: var(--ink-2); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.focus-stats b { font-family: var(--display); font-size: 28px; font-weight: 600; }
.focus-stats span { font-size: 12px; color: var(--on-ink-muted); }

.sets { display: flex; flex-direction: column; gap: 10px; }
.sets > span { font-size: 13px; color: var(--on-ink-muted); }
.set-row { display: flex; flex-wrap: wrap; gap: 8px; }
.set {
  flex: 1 1 80px; min-height: 52px; border-radius: 16px; cursor: pointer; font-weight: 600; font-size: 14px;
  border: 1.5px solid var(--ink-line); background: none; color: var(--on-ink);
}
.set[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.focus-nav { margin-top: auto; display: flex; gap: 10px; }
.focus-nav .prev {
  flex: none; width: 56px; height: 56px; border-radius: 18px; border: 1.5px solid var(--ink-line);
  background: none; color: var(--on-ink); display: grid; place-items: center; cursor: pointer;
}
.focus-nav .prev:disabled { opacity: .4; cursor: default; }
.focus-nav .prev svg { width: 20px; height: 20px; stroke-width: 2.2; }
.focus-nav .next {
  flex: 1; height: 56px; border-radius: 18px; border: 0; background: var(--accent); color: var(--on-accent);
  font-weight: 600; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
}
.focus-nav .next svg { width: 18px; height: 18px; stroke-width: 2.4; }
