/* Workout: a gym floor. Concrete and iron, with the competition plate colours carrying meaning:
   red = act / new best, blue = from your coach, yellow = rest, green = done. */
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(/fonts/barlow-condensed-600.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url(/fonts/barlow-condensed-800.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-weight: 200 800; font-display: swap; src: url(/fonts/atkinson-next.woff2) format("woff2"); }

:root {
  --floor: #e6e6e3;      /* concrete */
  --panel: #f4f4f2;      /* chalked board */
  --ink: #17191c;        /* iron */
  --soft: #5d6066;
  --line: #c9c9c5;
  --red: #d7262b; --on-red: #fff;
  --blue: #1f5fbf;
  --yellow: #e9b90f;
  --green: #2e8b4a;
  --field: #fff;
  color-scheme: light;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Atkinson Hyperlegible Next", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --floor: #1e2022; --panel: #282b2e; --ink: #f1f0ec; --soft: #a9abaf; --line: #3d4044; --field: #15171a;
    --red: #ef4b4f; --blue: #6b9cf0; --yellow: #f2c838; --green: #4cb36b; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --floor: #1e2022; --panel: #282b2e; --ink: #f1f0ec; --soft: #a9abaf; --line: #3d4044; --field: #15171a;
  --red: #ef4b4f; --blue: #6b9cf0; --yellow: #f2c838; --green: #4cb36b; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .tabs and others set display, which would otherwise win over hidden */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--floor); color: var(--ink); font: 400 17px/1.45 var(--body); font-variant-numeric: tabular-nums; }
main { max-width: 560px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px calc(150px + env(safe-area-inset-bottom)); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.loading, .muted { color: var(--soft); }
.loading { text-align: center; padding: 40px 0; }

h1, h2, h3, .num { font-family: var(--cond); }
h1 { font-weight: 800; font-size: 44px; line-height: 1; margin: 6px 0 14px; letter-spacing: -0.01em; }
h2 { font-weight: 800; font-size: 28px; line-height: 1.05; margin: 26px 0 10px; }
h3 { font-weight: 800; font-size: 23px; line-height: 1.1; margin: 0; }
p { margin: 0 0 10px; }

/* Buttons: one red action per screen, the rest are outlined iron. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border: 2px solid var(--ink);
  background: none; font-family: var(--cond); font-weight: 800; font-size: 20px; text-decoration: none; cursor: pointer; border-radius: 6px; }
.btn.go { background: var(--red); border-color: var(--red); color: var(--on-red); }
.btn.wide { width: 100%; }
.btn.small { min-height: 38px; font-size: 17px; padding: 0 12px; }
.btn:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; padding: 6px 0; color: var(--soft); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 15px; }
.link.danger { color: var(--red); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 10px; }

/* Lists: rows on a board, separated by rules, not floating cards. */
.board { background: var(--panel); border-radius: 8px; padding: 2px 14px; }
.board > * + * { border-top: 1px solid var(--line); }
.item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 12px 0; text-decoration: none; }
.item b { font-family: var(--cond); font-weight: 800; font-size: 21px; line-height: 1.15; }
.item small { grid-column: 1; color: var(--soft); font-size: 15px; }
.item .go-to { color: var(--soft); font-size: 22px; }
button.item { width: 100%; background: none; border: 0; text-align: left; cursor: pointer; color: inherit; }

/* Homework from a coach: the blue edge says who it's from. */
.plan { border-left: 6px solid var(--blue); background: var(--panel); border-radius: 0 8px 8px 0; padding: 12px 14px; display: grid; gap: 8px; }
.plan.own { border-left-color: var(--ink); }
.plan .from { color: var(--blue); font-size: 15px; margin: 0; }
.plan.own .from { color: var(--soft); }
.week { display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--soft); }
.week i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--green); }
.week i.on { background: var(--green); }

/* The workout: one block per exercise. */
.ex { background: var(--panel); border-radius: 8px; padding: 12px 12px 8px; margin-bottom: 14px; }
.ex-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.ex-head h3 button { all: unset; cursor: pointer; }
.ex-head h3 button:focus-visible { outline: 3px solid var(--blue); }
.ex .how { font-size: 15px; color: var(--soft); white-space: pre-line; margin: 6px 0 0; }
.ex .note { color: var(--blue); font-size: 15px; margin: 6px 0 0; }
.last { font-size: 15px; color: var(--soft); margin: 4px 0 0; }
.last b { color: var(--ink); font-weight: 700; }
.beat { color: var(--red); font-weight: 700; }
.sets { width: 100%; border-collapse: collapse; margin-top: 8px; }
.sets th { font-weight: 400; font-size: 13px; color: var(--soft); text-align: left; padding: 0 4px 2px; }
.sets td { padding: 4px; }
.sets td:first-child { width: 30px; font-family: var(--cond); font-weight: 800; font-size: 22px; color: var(--soft); }
.sets input { width: 100%; min-width: 0; min-height: 46px; padding: 0 8px; border: 2px solid var(--line); border-radius: 6px; background: var(--field);
  font-family: var(--cond); font-weight: 800; font-size: 24px; text-align: center; }
.sets input::placeholder { color: var(--soft); opacity: .6; }
.tick { width: 54px; min-height: 46px; border: 2px solid var(--line); border-radius: 6px; background: var(--field); cursor: pointer; font-size: 22px; color: var(--soft); }
.tick[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.tick.hold { font-family: var(--cond); font-weight: 800; font-size: 18px; color: var(--ink); }
tr.done input { border-color: var(--green); }
.best { display: block; color: var(--red); font-family: var(--cond); font-weight: 800; font-size: 16px; text-align: center; }

/* The bar, loaded: the plates for each side in competition colours. */
.bar { display: flex; align-items: center; height: 46px; margin: 8px 0 2px; }
.bar .shaft { flex: 1; height: 6px; background: var(--soft); border-radius: 3px; min-width: 24px; }
.bar .sleeve { display: flex; align-items: center; gap: 2px; }
.bar .plate { width: 11px; border-radius: 2px; display: grid; place-items: center; }
.bar .collar { width: 6px; height: 16px; background: var(--soft); border-radius: 2px; }
.bar-label { font-size: 14px; color: var(--soft); text-align: center; margin: 0 0 4px; }
.p25 { height: 44px; background: #d7262b; } .p20 { height: 42px; background: #1f5fbf; } .p15 { height: 38px; background: #e9b90f; }
.p10 { height: 34px; background: #2e8b4a; } .p5 { height: 26px; background: #f1f0ec; border: 1px solid #8a8d92; } .p2-5 { height: 20px; background: #17191c; }
.p1-25 { height: 16px; background: #8a8d92; }
.p45 { height: 44px; background: #1f5fbf; } .p35 { height: 40px; background: #e9b90f; }

/* Rest timer: a yellow bar that drains, above the tabs. */
.rest { position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--floor); z-index: 5; }
.rest .fill { position: absolute; inset: 0 auto 0 0; background: var(--yellow); opacity: .35; }
.rest-in { position: relative; max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 8px 16px; }
.rest b { font-family: var(--cond); font-weight: 800; font-size: 30px; flex: 1; }
.rest button { background: none; border: 2px solid var(--floor); color: var(--floor); border-radius: 6px; min-height: 40px; padding: 0 12px; font-family: var(--cond); font-weight: 800; font-size: 17px; cursor: pointer; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: var(--panel); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
.tabs a { flex: 1; max-width: 112px; text-align: center; padding: 10px 2px 12px; text-decoration: none; font-family: var(--cond); font-weight: 800; font-size: 17px; color: var(--soft); border-top: 4px solid transparent; }
.tabs a[aria-current="page"] { color: var(--ink); border-top-color: var(--red); }

/* Forms. */
label.field { display: grid; gap: 4px; font-size: 15px; color: var(--soft); }
.field input, .field select, .field textarea, .search { min-height: 48px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 6px; background: var(--field); color: var(--ink); font-size: 17px; }
.field textarea { min-height: 96px; resize: vertical; }
.search { width: 100%; margin-bottom: 10px; }
.choice { display: flex; gap: 6px; flex-wrap: wrap; }
.choice button { min-height: 44px; min-width: 44px; padding: 0 12px; border: 2px solid var(--line); border-radius: 6px; background: var(--field); cursor: pointer; font-family: var(--cond); font-weight: 800; font-size: 19px; }
.choice button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--floor); }
.error { color: var(--red); font-weight: 700; }
.ok { color: var(--green); font-weight: 700; }

/* Plan editor rows. */
.pitem { background: var(--panel); border-radius: 8px; padding: 10px 12px; display: grid; gap: 8px; }
.pitem .nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pitem .nums input { width: 100%; }

/* Sheets slide up over the page (picker, finishing a workout). */
.sheet { position: fixed; inset: 0; z-index: 10; background: var(--floor); overflow-y: auto; }
.sheet-in { max-width: 560px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px 40px; }
.sheet-in > * + * { margin-top: 14px; }
.stack + p, .board + p { margin-top: 14px; }
.sheet-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
@media (prefers-reduced-motion: no-preference) { .sheet:not([hidden]) { animation: up .18s ease-out; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }

.chart { width: 100%; height: 140px; display: block; }
.chart path { fill: none; stroke: var(--red); stroke-width: 3; stroke-linejoin: round; }
.chart circle { fill: var(--red); }
.chart line { stroke: var(--line); }
.tag { display: inline-block; font-size: 13px; padding: 1px 7px; border-radius: 10px; background: var(--line); color: var(--ink); vertical-align: middle; }
.tag.blue { background: var(--blue); color: #fff; }
footer { margin-top: 30px; color: var(--soft); font-size: 13px; }
.intro { padding-top: 10vh; }
.intro .lede { font-size: 20px; max-width: 30ch; }

/* Coach pictures: round, on the dark backdrop they were drawn on. */
.face { border-radius: 50%; object-fit: cover; vertical-align: middle; background: #222; flex: none; }
.plan .from { display: flex; align-items: center; gap: 8px; }
.item .who { display: flex; align-items: center; gap: 10px; }
.choice.pics button { padding: 4px; min-height: 0; }
.coaches { display: flex; margin-bottom: 18px; }
.coaches .face + .face { margin-left: -16px; border: 4px solid var(--floor); }
