/*
  Novo Tracker. Colours are taken from the gym itself: rubber floor charcoal, matte black
  Primal steel, chalk, and the burnt-orange feature wall. Orange is the only accent and
  it always means "act here" or "record".
*/
@font-face { font-family: "Barlow Condensed"; src: url("fonts/barlow-condensed-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("fonts/barlow-condensed-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  color-scheme: dark;
  --floor: #141311;
  --steel: #1d1c1a;
  --steel-2: #272522;
  --rule: #2f2d29;
  --rule-2: #4a4640;
  --chalk: #ebe5d9;
  --chalk-2: #b7b0a3;
  --dust: #8f887c;
  --wall: #e8862a;
  --wall-press: #c96f1e;
  --wall-ink: #1a0f05;
  --wall-deep: #3d2510;
  --good: #93c26f;
  --bad: #e4705a;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --text: "IBM Plex Sans", -apple-system, "Helvetica Neue", sans-serif;
  --r: 3px;
  --tab-h: 56px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  background: var(--floor);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--floor);
  color: var(--chalk);
  font: 16px/1.45 var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--wall); outline-offset: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; opacity: 0; }
.dim { color: var(--dust); }

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 12px) 16px calc(var(--tab-h) + var(--safe-b) + 28px);
}
body.resting .view { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 84px); }

/* ---------- Masthead & page heads ---------- */
.mast { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.brand { display: flex; align-items: stretch; gap: 8px; }
.brand-block {
  padding: 6px 8px 4px;
  border-radius: 2px;
  background: var(--wall);
  color: var(--wall-ink);
  font: 600 23px/1 var(--display);
  letter-spacing: 0.07em;
}
.brand-txt { align-self: center; font: 600 13px/1 var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--chalk-2); }

.head { margin: 4px 0 22px; }
.head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.head h1 { margin: 0; font: 600 30px/1.1 var(--display); letter-spacing: 0.015em; text-transform: uppercase; }
.lede { margin: 6px 0 0; max-width: 34em; color: var(--chalk-2); line-height: 1.5; }
.lede b { color: var(--chalk); font-weight: 600; }

/* Exercise picker that reads as the page title */
.pick { position: relative; display: flex; align-items: baseline; gap: 12px; }
.pick select {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px dashed var(--rule-2);
  background: none;
  font: 600 31px/1.15 var(--display);
  letter-spacing: 0.015em;
  text-transform: uppercase;
  -webkit-appearance: none;
  appearance: none;
}
.pick-cue { flex: none; font: 600 14px var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--wall); pointer-events: none; }

/* ---------- Sections ---------- */
.block { margin-top: 40px; }
.block-month { margin-top: 30px; }
.sec { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.sec h2 { margin: 0; font: 600 15px/1.2 var(--display); letter-spacing: 0.11em; text-transform: uppercase; color: var(--dust); }
.sec a { font: 600 14px var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--wall); text-decoration: none; }
.sec-note { font-size: 13px; color: var(--dust); }
.note { margin: 10px 0 0; font-size: 14.5px; color: var(--dust); line-height: 1.5; }
.note-top { margin: 0 0 14px; }
.about { margin: 28px 0 0; font-size: 13.5px; color: var(--dust); line-height: 1.5; }

/* ---------- Buttons ---------- */
.act {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r);
  background: var(--wall);
  color: var(--wall-ink);
  font: 600 20px/1 var(--display);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: left;
}
.act small { font: 600 14px var(--text); letter-spacing: 0; text-transform: none; }
.act:active { background: var(--wall-press); }
.act.logged { background: var(--chalk); color: var(--floor); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 12px;
  padding: 0 16px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: none;
  color: var(--chalk);
  font: 600 16px/1 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.btn:active { background: var(--steel-2); }
.btn-pair { display: flex; gap: 8px; }
.btn-pair .btn { flex: 1; }

.text-btn {
  min-height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--wall);
  font: 600 15px/1 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.text-btn.inline { min-height: 0; font-size: 14px; }
.text-btn.small { min-height: 36px; font-size: 13px; color: var(--chalk-2); }
.text-btn.danger { color: var(--bad); }
.rows + .text-btn, .block > .text-btn { margin-top: 10px; }

/* ---------- Today ---------- */
.notice { display: flex; align-items: flex-start; gap: 14px; margin: 0 0 20px; padding: 12px 14px; border: 1px solid var(--rule-2); border-radius: var(--r); font-size: 14.5px; color: var(--chalk-2); }
.notice p { flex: 1; margin: 0; }
.notice b { color: var(--chalk); font-weight: 600; }
.notice .text-btn { min-height: 0; padding-top: 2px; font-size: 13px; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); margin: 12px 0 0; padding: 0; list-style: none; text-align: center; }
.wk-d { display: block; font: 600 12.5px var(--display); letter-spacing: 0.12em; color: var(--dust); }
.wk-n {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 4px auto 0;
  border-radius: 2px;
  font: 600 18px var(--display);
  font-variant-numeric: tabular-nums;
  color: var(--chalk-2);
}
.week .on .wk-n { background: var(--wall); color: var(--wall-ink); }
.week .today .wk-n { box-shadow: inset 0 0 0 1px var(--chalk); color: var(--chalk); }
.week .today.on .wk-n { box-shadow: inset 0 0 0 2px var(--wall-ink); color: var(--wall-ink); }
.week-sum { margin: 14px 0 0; color: var(--chalk-2); font-variant-numeric: tabular-nums; }

.figure { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 6px; margin: 4px 0 0; }
.fig-n { font: 600 60px/0.95 var(--display); }
.fig-u { font: 600 24px var(--display); color: var(--chalk-2); }
.fig-l { margin-left: 6px; font: 600 15px var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--dust); }
.fig-src { margin: 6px 0 0; font-size: 14.5px; color: var(--chalk-2); }

.facts { margin: 18px 0 0; }
.facts > div { display: grid; grid-template-columns: 7.2rem 1fr auto; align-items: baseline; gap: 10px; padding: 5px 0; }
.facts dt { font-size: 14px; color: var(--dust); }
.facts dd { margin: 0; font: 600 20px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.facts dd small { font-size: 15px; color: var(--chalk-2); }
.facts dd.when { font: 400 13.5px/1.3 var(--text); color: var(--dust); text-align: right; }
.facts dd.none { font: 400 15px var(--text); color: var(--dust); }

.stack { display: flex; gap: 3px; height: 12px; margin-top: 14px; }
.stack i { display: block; overflow: hidden; border-radius: 1px; background: var(--steel-2); }
.stack b { display: block; height: 100%; background: var(--wall); }

/* ---------- Rows (exercise lists) ---------- */
.rows { margin: 0; padding: 0; list-style: none; }
.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 15px 0 13px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  text-align: left;
}
button.row:active { background: var(--steel); }
.rows li:last-child .row { border-bottom: 0; }
.row-name { font-size: 17px; font-weight: 600; line-height: 1.25; }
.row-name small { margin-left: 4px; font-size: 13.5px; font-weight: 400; color: var(--dust); }
.row-val { font: 600 19px/1 var(--display); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.row-val.hot { color: var(--wall); }
.row-val.dim { color: var(--dust); }
.set-group .row { border-bottom: 0; }

.filters, .opts {
  display: flex;
  gap: 18px;
  margin: 0 -16px;
  padding: 0 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--rule);
  scrollbar-width: none;
}
.filters::-webkit-scrollbar, .opts::-webkit-scrollbar { display: none; }
.filters button, .opts button {
  flex: none;
  margin-bottom: -1px;
  padding: 11px 0 9px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--dust);
  font: 600 16px/1 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.filters [aria-selected="true"], .opts [aria-checked="true"] { color: var(--chalk); border-bottom-color: var(--wall); }
.opts.quiet { gap: 16px; border-bottom: 0; }
.opts.quiet button { padding: 10px 0 6px; font-size: 14px; }

/* ---------- Sessions & sets ---------- */
.day { padding: 14px 0 16px; border-bottom: 1px solid var(--rule); }
.day-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.day-h h3 { margin: 0; font: 600 19px/1.2 var(--display); letter-spacing: 0.04em; text-transform: uppercase; }
.day-h span { font-size: 13.5px; color: var(--dust); white-space: nowrap; }
.day-ex { margin-top: 12px; }
.day-ex-name { font-size: 14.5px; font-weight: 600; color: var(--chalk-2); }

.sets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.set {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 36px;
  padding: 8px 10px 6px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  background: none;
  font: 600 18px/1 var(--display);
  font-variant-numeric: tabular-nums;
}
.set:active { background: var(--steel-2); }
.set.pr { border-color: var(--wall); }
.pr-tag { margin-left: 2px; font: 600 12.5px/1 var(--display); letter-spacing: 0.1em; color: var(--wall); }

/* ---------- Tables ---------- */
.log { width: 100%; margin-top: 2px; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.log th { padding: 4px 8px 6px 0; border-bottom: 1px solid var(--rule); text-align: left; font: 600 13px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dust); }
.log td { padding: 9px 8px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.log tr:last-child td { border-bottom: 0; }
.log .r { padding-right: 0; text-align: right; }
.log .num { font: 600 18px var(--display); }
.log .gain { font-size: 13px; color: var(--chalk-2); }

/* ---------- Charts ---------- */
.chart { position: relative; margin: 14px 0 0; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.block .chart { margin-top: 14px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.c-grid line { stroke: var(--rule); stroke-width: 1; shape-rendering: crispEdges; }
.c-tick { fill: var(--dust); font: 12px var(--text); font-variant-numeric: tabular-nums; }
.c-line { fill: none; stroke: var(--wall); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.c-dot { fill: var(--wall); stroke: var(--floor); stroke-width: 2; }
.c-dot-on { fill: var(--chalk); stroke: var(--wall); stroke-width: 2.5; }
.c-label { fill: var(--chalk); font: 600 16px var(--display); }
.c-label-best { fill: var(--chalk-2); font-weight: 500; }
.c-xhair { stroke: var(--chalk-2); stroke-width: 1; }
.c-hit { outline: none; cursor: crosshair; }
.c-tip {
  position: absolute;
  top: -10px;
  display: flex;
  flex-direction: column;
  padding: 7px 10px 6px;
  border-left: 3px solid var(--wall);
  border-radius: 2px;
  background: var(--steel-2);
  color: var(--chalk-2);
  font-size: 12.5px;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
}
.c-tip strong { color: var(--chalk); font: 600 20px/1.1 var(--display); }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1.05fr 1.1fr 1.05fr 1fr;
  padding: 0 max(0px, calc((100vw - 560px) / 2)) var(--safe-b);
  border-top: 1px solid var(--rule-2);
  background: var(--steel);
}
.tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--tab-h);
  color: var(--dust);
  font: 600 15px/1 var(--display);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
}
.tab[aria-current="page"] { color: var(--chalk); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 18%; right: 18%; height: 3px; background: var(--wall); }
.tab-log { background: var(--wall); color: var(--wall-ink); font-size: 18px; letter-spacing: 0.12em; }
.tab-log:active { background: var(--wall-press); }
.tab-log[aria-current="page"] { color: var(--wall-ink); }
.tab-log[aria-current="page"]::before { background: var(--chalk); }

/* ---------- Sheets ---------- */
.sheet-root { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 9, 8, 0.74); }
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  max-height: calc(100% - var(--safe-t) - 14px);
  margin: 0 auto;
  border-top: 3px solid var(--wall);
  border-radius: 4px 4px 0 0;
  outline: none;
  background: var(--steel);
  transform: translateY(100%);
  transition: transform 0.24s cubic-bezier(0.3, 0.8, 0.3, 1);
}
.sheet-tall { height: calc(100% - var(--safe-t) - 14px); }
.sheet-root.open .sheet { transform: none; }
.sheet-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--rule);
  touch-action: none;
}
.sheet-head h2 { margin: 0; font: 600 26px/1.1 var(--display); letter-spacing: 0.02em; text-transform: uppercase; }
.sheet-sub { margin: 4px 0 0; font-size: 14px; color: var(--dust); }
.sheet-head .text-btn { min-height: 0; padding-top: 6px; }
.grab { position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--rule-2); }
.sheet-body { flex: 1; padding: 14px 16px calc(var(--safe-b) + 28px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
body.sheet-open { overflow: hidden; }

/* Logger */
.lg-last { margin-bottom: 4px; }
.date-btn {
  position: relative;
  flex: none;
  font: 600 15px/1 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--wall);
  white-space: nowrap;
}
.date-btn input { position: absolute; inset: -10px -6px; width: calc(100% + 12px); height: calc(100% + 20px); border: 0; opacity: 0; font-size: 16px; -webkit-appearance: none; appearance: none; }

.dials { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; margin: 16px 0 12px; }
.dials-one { grid-template-columns: 1fr; }
.dial { min-width: 0; padding: 10px 10px 12px; border-radius: var(--r); background: var(--steel-2); }
.dial label { display: block; font: 600 14px var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--chalk-2); }
.dial-n {
  width: 100%;
  min-width: 0;
  padding: 4px 0 4px;
  border: 0;
  border-bottom: 2px solid var(--rule-2);
  border-radius: 0;
  outline: none;
  background: none;
  font: 600 54px/1 var(--display);
  font-variant-numeric: tabular-nums;
}
.dial-n:focus { border-bottom-color: var(--wall); }
.dial-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.dial-steps button {
  min-height: 48px;
  padding: 0;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  background: var(--steel);
  font: 600 19px/1 var(--display);
  font-variant-numeric: tabular-nums;
}
.dial-steps button:active { background: var(--floor); }
.shake { animation: shake 0.3s; }
@keyframes shake {
  25% { transform: translateX(-5px); }
  60% { transform: translateX(4px); }
}

.lg-sets-head { margin-top: 26px; }
.today-sets { margin: 0; padding: 0; list-style: none; }
.today-sets li { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--rule); }
.today-sets li:last-child { border-bottom: 0; }
/* The set you just logged starts orange-tinted and settles, so you can see it landed. */
.today-sets li.fresh { animation: landed 1.6s ease-out; }
@keyframes landed { from { background: var(--wall-deep); } to { background: transparent; } }
.ts-main { display: flex; align-items: baseline; gap: 12px; flex: 1; min-height: 52px; padding: 14px 0 12px; border: 0; background: none; text-align: left; }
.ts-n { width: 1.2rem; font: 600 15px var(--display); color: var(--dust); }
.ts-set { flex: 1; font: 600 22px/1 var(--display); font-variant-numeric: tabular-nums; }
.ts-set .pr-tag { margin-left: 7px; }
.ts-cmp { font-size: 13.5px; color: var(--dust); white-space: nowrap; }
.ts-cmp.up { color: var(--good); }
.ts-cmp.down { color: var(--bad); }
.ts-del { flex: none; min-height: 36px; padding: 0 10px; border: 1px solid var(--bad); border-radius: 2px; background: none; color: var(--bad); font: 600 14px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; }

/* Settings */
.set-group { margin-bottom: 30px; }
.set-group .opts { margin-top: 2px; }
.field { display: grid; gap: 5px; margin-top: 12px; }
.field > span { font: 600 13px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--chalk-2); }
.input {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  background: var(--steel-2);
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--chalk-2); opacity: 0.6; }
.row2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 8px; }
.add-form .btn { width: 100%; }
.set-group > .text-btn { margin-top: 2px; }
.row-static { cursor: default; }
#es-save, #goal-save { margin-top: 18px; }
#es-del, #goal-clear { display: block; margin: 14px auto 0; }

/* ---------- Rest timer & toast ---------- */
.rest {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 8px 0 12px;
  overflow: hidden;
  border-left: 3px solid var(--chalk-2);
  border-radius: 2px;
  background: var(--steel-2);
}
.rest-l { font: 600 14px var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--chalk-2); white-space: nowrap; }
.rest-t { flex: 1; font: 600 28px/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rest button {
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  background: none;
  font: 600 15px/1 var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rest-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--chalk-2); transition: width 0.25s linear; }
.rest.done { border-left-color: var(--wall); }
.rest.done .rest-t { color: var(--wall); font-size: 22px; letter-spacing: 0.06em; text-transform: uppercase; }
.rest.done .rest-bar { background: var(--wall); }
.rest-inline { margin-top: 10px; }
.rest-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tab-h) + var(--safe-b));
  z-index: 19;
  max-width: 560px;
  margin: 0 auto;
  border-top: 1px solid var(--rule-2);
  border-radius: 0;
}
body.sheet-open .rest-dock { display: none; }

.toast {
  position: fixed;
  top: calc(var(--safe-t) + 8px);
  left: 10px;
  right: 10px;
  z-index: 60;
  display: none;
  align-items: center;
  gap: 14px;
  max-width: 540px;
  margin: 0 auto;
  padding: 11px 14px;
  border: 1px solid var(--rule-2);
  border-left: 3px solid var(--chalk-2);
  border-radius: 2px;
  background: var(--steel-2);
  font-size: 15px;
  line-height: 1.4;
}
.toast.show { display: flex; }
.toast p { flex: 1; margin: 0; }
.toast.pr { border-left-color: var(--wall); }
.t-kind { display: block; margin-bottom: 1px; font: 600 13px var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--wall); }
.toast .text-btn { min-height: 0; }

.noscript { padding: 40px 20px; }

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