/* Workouts — the A/B artifact's palette, rebuilt for one-handed use between sets. */
:root {
  --bg:#ECECE4; --surface:#FFFFFF; --surface-2:#F4F4EE;
  --text:#1A1C1D; --muted:#6C7072; --line:#DBDBD1;
  --a:#2C6E8F; --a-soft:#E1EEF3;
  --b:#AC5F28; --b-soft:#F5E8DB;
  --prev:#4C8A52; --prev-soft:#E3EEE2;
  --flare:#B03A33; --flare-soft:#F6E3E1;
  --learn:#6A5AA6; --learn-soft:#E9E5F3;
  --atg:#A8476B; --atg-soft:#F3E1E8;
  --accent:#1A1C1D;
  --radius:13px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#111317; --surface:#1B1E23; --surface-2:#23272E;
    --text:#E8E9E6; --muted:#969C9E; --line:#2C313A;
    --a:#5CA7C5; --a-soft:#16303A;
    --b:#D68A4E; --b-soft:#33241A;
    --prev:#7BB980; --prev-soft:#1A2A1D;
    --flare:#E0746C; --flare-soft:#33201E;
    --learn:#AA9BD8; --learn-soft:#231E33;
    --atg:#D2789A; --atg-soft:#33202A;
    --accent:#E8E9E6;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: inherit; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 14px 0 6px; }
h2.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 2px 8px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 8px 16px 24px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.lede { color: var(--muted); font-size: 15px; margin: 4px 0 12px; }
.kicker { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }

/* ---- bars */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 17px; text-decoration: none; margin-right: auto; }
.badge { font-size: 12.5px; font-weight: 700; background: var(--learn-soft); color: var(--learn);
  border-radius: 20px; padding: 3px 10px; text-decoration: none; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { flex: 1; text-align: center; padding: 12px 0 13px; font-size: 13px; font-weight: 600;
  color: var(--muted); text-decoration: none; }
.tabbar a.on { color: var(--text); box-shadow: inset 0 2px 0 var(--text); }

/* ---- buttons & inputs */
.btn { font: inherit; font-weight: 700; font-size: 15px; border-radius: 10px; padding: 10px 16px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
  text-decoration: none; display: inline-block; }
.btn.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.sm { font-size: 13px; padding: 6px 11px; }
.btn.big { font-size: 17px; padding: 14px 20px; }
.btn.wide { display: block; width: 100%; text-align: center; margin: 18px 0 8px; }
.btn:disabled { opacity: .5; }
input, textarea, select { font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%; }
textarea { resize: vertical; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 10px 0 0; }
label > input, label > textarea, label > select { margin-top: 4px; }
form { margin: 0; }
.flash { background: var(--prev-soft); color: var(--prev); border-radius: 10px; padding: 4px 14px;
  margin: 10px 0; font-weight: 600; font-size: 14px; }
.err { color: var(--flare); font-weight: 600; }

/* ---- colour families per workout */
.c-a { --wc: var(--a); --wc-soft: var(--a-soft); }
.c-b { --wc: var(--b); --wc-soft: var(--b-soft); }
.c-am, .c-pm { --wc: var(--atg); --wc-soft: var(--atg-soft); }
.chip { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 6px;
  border-radius: 7px; font-size: 12.5px; font-weight: 800; background: var(--wc-soft); color: var(--wc); }

/* ---- home */
.hero-card { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--wc);
  border-radius: var(--radius); text-decoration: none; }
.hero-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; color: var(--wc); }
.hero-cta { font-weight: 700; }
.hero-card .btn { margin-top: 6px; width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { font: inherit; width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px;
  padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  border-top: 4px solid var(--wc, var(--line)); color: var(--text); cursor: pointer; text-decoration: none; }
.tile span { font-size: 13px; color: var(--muted); }
.row-link { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line);
  text-decoration: none; }

/* ---- program / exercises */
.seg { display: flex; gap: 6px; margin-top: 12px; }
.seg a { flex: 1; text-align: center; padding: 8px 0; border-radius: 10px; font-weight: 700; font-size: 14px;
  text-decoration: none; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.seg a.on { background: var(--wc-soft); color: var(--wc); border-color: var(--wc); }
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 14px 8px; margin-top: 14px; }
.block-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 11px 2px 8px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px; }
.block-title .meta { font-size: 12px; color: var(--muted); font-weight: 500; text-align: right; }
details.block.quiet > summary { list-style: none; cursor: pointer; border-bottom: none; }
details.block.quiet[open] > summary { border-bottom: 1px solid var(--line); }
details.block.quiet > summary::-webkit-details-marker { display: none; }
details.block.quiet > summary .meta::after { content: " ▸"; }
details.block.quiet[open] > summary .meta::after { content: " ▾"; }
.ex { padding: 11px 2px; border-bottom: 1px solid var(--line); }
.ex:last-child { border-bottom: none; }
details.ex > summary { list-style: none; cursor: pointer; }
details.ex > summary::-webkit-details-marker { display: none; }
.ex-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ex-name { font-size: 15px; font-weight: 650; }
.ex-dose { font-size: 14px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.ex-note { font-size: 13px; color: var(--muted); margin-top: 3px; }
.ex.prev { border-left: 3px solid var(--prev); padding-left: 11px;
  background: linear-gradient(90deg, var(--prev-soft), transparent 55%); border-radius: 4px; }
.ex.atg { border-left: 3px solid var(--atg); padding-left: 11px;
  background: linear-gradient(90deg, var(--atg-soft), transparent 55%); border-radius: 4px; }
.ex.mini { padding: 7px 2px; }
.ex.mini .ex-name { font-weight: 500; font-size: 14px; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 20px; padding: 0 8px;
  margin-left: 6px; vertical-align: 2px; border: 1px solid; }
.pill.prev { color: var(--prev); background: var(--prev-soft); }
.pill.atg { color: var(--atg); background: var(--atg-soft); }
form.edit { padding: 4px 0 8px; }
form.edit .btn { margin-top: 12px; }

/* ---- live session */
.sess-head h1 { color: var(--wc); }
.ex.live { padding: 14px 2px; }
.last { font-size: 13px; color: var(--muted); margin-top: 4px; }
.hint { font-size: 13px; font-weight: 600; color: var(--prev); margin-top: 4px; }
details.cue summary { font-size: 12.5px; color: var(--muted); cursor: pointer; margin-top: 2px; }
details.cue p { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.done-sets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.setchip { display: inline-flex; align-items: center; gap: 2px; background: var(--prev-soft); color: var(--prev);
  font-weight: 700; font-size: 14px; border-radius: 8px; padding: 3px 4px 3px 9px; }
.setchip .x { border: 0; background: none; color: inherit; font-size: 17px; line-height: 1; padding: 2px 6px; cursor: pointer; opacity: .6; }
.setform { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; margin-top: 10px; align-items: end; }
.setform label { margin: 0; position: relative; }
.setform label span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); pointer-events: none; }
.setform input { font-size: 18px; font-weight: 700; padding: 10px 40px 10px 11px; text-align: left; }
.setform .btn { padding: 11px 8px; }
.setform .count { opacity: .6; font-weight: 600; font-size: 13px; }
.restbar { position: fixed; left: 12px; right: 12px; bottom: calc(62px + env(safe-area-inset-bottom)); z-index: 25;
  max-width: 696px; margin: 0 auto; display: flex; align-items: center; gap: 12px;
  background: var(--accent); color: var(--bg); border-radius: 12px; padding: 10px 14px; }
.restbar b { font-size: 22px; margin-right: auto; }
.restbar .btn { color: var(--bg); border-color: color-mix(in srgb, var(--bg) 40%, transparent); }
.restbar.done { background: var(--prev); }
.danger-zone { margin-top: 18px; text-align: center; }

/* ---- chat */
.thread { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 88%; padding: 9px 13px; border-radius: 14px; font-size: 15px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--bg); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.status { align-self: flex-start; font-size: 13px; color: var(--muted); background: none; padding: 0 4px; }
.msg.saved { align-self: flex-start; font-size: 12.5px; font-weight: 600; color: var(--learn); background: var(--learn-soft); }
.ask { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.ask textarea { flex: 1; }

/* ---- cards / review / notes */
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px; margin-top: 12px; text-decoration: none; }
.card.review { border-left: 4px solid var(--learn); }
.card.review .what { font-weight: 700; }
.card.review p { margin: 4px 0; font-size: 14px; }
.card .actions { display: flex; gap: 8px; margin-top: 8px; }
.card.hist .what { font-weight: 700; font-size: 14px; }
.card.hist p { margin: 2px 0 6px; font-size: 14px; }
.card.hist.reverted { opacity: .55; }
.card.learn { border-left: 4px solid var(--learn); }
.card.learn summary { list-style: none; cursor: pointer; }
.card.learn summary::-webkit-details-marker { display: none; }
.card.learn .date { font-size: 12px; font-weight: 700; color: var(--learn); }
.card.learn h3 { margin: 2px 0 6px; font-size: 16px; }
.card.learn ul, .card.review ul { margin: 0; padding-left: 18px; font-size: 14px; }
.card.sess .small { margin-top: 3px; }
.feel { display: flex; gap: 8px; margin-top: 6px; }
.feel label { margin: 0; flex: 1; }
.feel input { position: absolute; opacity: 0; width: 1px; }
.feel span { display: block; text-align: center; padding: 10px 0; border: 1px solid var(--line); border-radius: 9px;
  font-size: 17px; font-weight: 700; color: var(--text); background: var(--surface-2); }
.feel input:checked + span { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--a); border-radius: 3px; }
.lift-pick { margin: 10px 0; }
.prose { font-size: 15px; }
.prose h2 { font-size: 17px; margin: 22px 0 6px; }
.prose h3 { font-size: 15px; margin: 16px 0 4px; color: var(--muted); }
.prose ul, .prose ol { padding-left: 20px; }
.prose li { margin: 5px 0; }
.login { max-width: 360px; margin: 60px auto; text-align: center; }
.login form { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }

/* ---- import */
.pickcard summary { list-style: none; cursor: pointer; }
.pickcard summary::-webkit-details-marker { display: none; }
label.pick { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text); font-size: 15px; }
label.pick input { width: 20px; height: 20px; flex: none; }
