/* Scoreboard: near-black, one acid accent, big tabular numbers, thumb-sized
   targets. Orange is reserved for PRs so it always means something. */
:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --surface: #151517;
  --surface-2: #1f1f22;
  --line: #2b2b30;
  --text: #f3f3ee;
  --muted: #8b8b93;
  --faint: #55555c;
  --accent: #c8ff2e;
  --accent-ink: #0b0b0c;
  --pr: #ff6b1a;
  --danger: #ff5050;
  --radius: 16px;
  --tab-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--font);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: inherit; }
[hidden] { display: none !important; }

main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 32px);
}

/* ---------- type ---------- */
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow b { color: var(--accent); font-weight: 700; }
h1.title {
  font-family: var(--display);
  font-size: 34px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 6px 0 4px;
}
h2.section {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 28px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
h2.section .grow { flex: 1; }
.num { font-variant-numeric: tabular-nums; font-family: var(--display); font-weight: 800; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.accent { color: var(--accent); }

/* ---------- buttons & inputs ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 650;
  min-height: 44px;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); background: transparent; }
.btn.big { width: 100%; min-height: 60px; font-size: 18px; font-weight: 800; letter-spacing: .02em; border-radius: 14px; }
.btn.small { min-height: 34px; padding: 6px 10px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .5; }
.link { background: none; border: 0; padding: 6px 0; color: var(--accent); font-weight: 650; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

input.field, select.field, textarea.field {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 46px;
  outline: none;
}
input.field:focus, select.field:focus, textarea.field:focus { border-color: var(--accent); }
textarea.field { min-height: 120px; resize: vertical; line-height: 1.5; }
label.lbl { display: block; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  background: rgba(11, 11, 12, .92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1;
  max-width: 140px;
  height: var(--tab-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
}
.tabbar svg { width: 24px; height: 24px; fill: currentColor; }
.tabbar a.on { color: var(--accent); }

/* ---------- today header ---------- */
.statline { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat .num { font-size: 22px; line-height: 1.1; }
.stat .eyebrow { font-size: 10px; }
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots i { width: 10px; height: 10px; border-radius: 3px; background: var(--line); }
.dots i.on { background: var(--accent); }

.daypicker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 18px -16px 0;
  padding: 2px 16px 4px;
  scrollbar-width: none;
}
.daypicker::-webkit-scrollbar { display: none; }
.daypicker button {
  flex: 0 0 auto;
  min-width: 84px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 10px 14px;
  position: relative;
}
.daypicker button b { display: block; font-size: 15px; }
.daypicker button span { display: block; font-size: 12px; color: var(--muted); }
.daypicker button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.daypicker button.on span { color: #55555c; }
.daypicker button.next::after {
  content: "";
  position: absolute; top: 9px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}

.live {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.live::before {
  content: "";
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(200, 255, 46, .6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(200, 255, 46, 0); } 100% { box-shadow: 0 0 0 0 rgba(200, 255, 46, 0); } }

/* ---------- blocks & cards ---------- */
.warmup {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--muted);
  font-size: 14px;
}
.warmup b { color: var(--text); font-weight: 650; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color .2s;
}
.card.done { opacity: .55; }
.card.open { opacity: 1; border-color: #3a3a40; }
.card.pr-flash { border-color: var(--pr); box-shadow: 0 0 0 1px var(--pr), 0 0 32px -6px rgba(255, 107, 26, .55); }

.card-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  align-items: center;
  padding: 14px 16px;
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
}
.card-head .name { font-weight: 650; font-size: 17px; }
.card-head .swapped { color: var(--muted); font-size: 12px; }
.card-head .rx {
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -.01em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.card-head .note { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.card-head .progress { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pill {
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
}
.pill.skip { color: var(--faint); text-decoration: line-through; }
.pill.pr { background: var(--pr); color: #160700; }
.pill.todo { background: transparent; border: 1px dashed var(--line); color: var(--faint); }

.logger { padding: 0 16px 16px; }
.logger .lastline { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.logger .lastline b { color: var(--text); font-weight: 600; }
.logger .tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.chip i { font-style: normal; color: var(--faint); margin-right: 6px; }
.chip.skip { color: var(--faint); text-decoration: line-through; }
.chip.pr { border-color: var(--pr); }
.chip.editing { border-color: var(--accent); color: var(--accent); }

.steppers { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 10px; }
.stepper {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: stretch;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  height: 72px;
}
.stepper button {
  border: 0;
  background: var(--surface-2);
  font-size: 26px;
  font-weight: 500;
  color: var(--text);
}
.stepper button:active { background: var(--line); }
.stepper .val { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
.stepper input {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  padding: 0;
  outline: none;
}
.stepper .unit { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: -2px; }

.extra-fields { display: flex; gap: 12px; flex-wrap: wrap; margin: 2px 0 10px; }
.extra-fields button { background: none; border: 0; color: var(--muted); font-size: 13px; font-weight: 650; padding: 4px 0; }

.logbtn { position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.logbtn .hold {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .28);
  transform-origin: left;
  transform: scaleX(0);
}
.logbtn.holding .hold { transform: scaleX(1); transition: transform .6s linear; }
.hint { text-align: center; font-size: 12px; color: var(--faint); margin-top: 6px; }

.prbanner {
  margin: 0 0 10px;
  border-radius: 12px;
  background: var(--pr);
  color: #160700;
  padding: 10px 14px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}
.prbanner b { font-family: var(--display); font-size: 22px; font-weight: 900; letter-spacing: .02em; text-transform: uppercase; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.blockhead { display: flex; align-items: center; gap: 8px; }
.blockhead .grow { flex: 1; }
.timerbtn {
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}

.summary {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.summary .statline { margin: 0 0 14px; justify-content: space-between; }

/* ---------- lists ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list > * { display: block; padding: 14px 16px; border-bottom: 1px solid var(--line); text-decoration: none; }
.list > *:last-child { border-bottom: 0; }
.list .top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.list .name { font-weight: 650; }
.tag {
  display: inline-block;
  font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
}
.tag.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.search { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0 10px; }
.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-top: 8px; }
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px; font-weight: 650;
  text-transform: capitalize;
}
.filters button.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.sessioncard .date { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.sessioncard .meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sessioncard .meta b { color: var(--text); font-weight: 650; }
.sessioncard .ex { font-size: 13px; color: var(--faint); margin-top: 4px; }

/* ---------- exercise detail ---------- */
.hero { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; }
.hero .num { font-size: 56px; line-height: 1; color: var(--accent); }
.hero .unit { font-size: 18px; font-weight: 700; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; text-align: center; }
.tile .eyebrow { font-size: 10px; }
.tile .num { font-size: 18px; display: block; margin-top: 2px; }
.tile .num.none { color: var(--faint); }
.chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 10px 6px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#fade); }
.chart .dot { fill: var(--bg); stroke: var(--accent); stroke-width: 2; }
.chart .bar { fill: var(--accent); }
.chart .bar.dim { fill: var(--surface-2); }
.chart .empty { fill: var(--faint); font-size: 12px; }

.setgroup { padding: 12px 16px; }
.setgroup .chips { margin: 6px 0 0; }

/* ---------- program editor ---------- */
.ed-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.ed-row { display: flex; gap: 6px; align-items: center; }
.ed-row .field { flex: 1; min-height: 40px; padding: 8px 12px; }
.ed-block { border-left: 2px solid var(--line); margin: 12px 0 0 4px; padding-left: 10px; }
.ed-block.is-emom { border-color: var(--accent); }
.ed-slot { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin-top: 6px; }
.ed-slot .exbtn { flex: 1; text-align: left; background: none; border: 0; font-weight: 650; padding: 6px 4px; }
.icon {
  width: 36px; height: 36px; flex: 0 0 36px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 10px;
  font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.icon.danger { color: var(--danger); }
.mini { min-height: 36px !important; padding: 6px 10px !important; font-size: 14px; }
.notes h3 { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; }
.notes p { margin: 8px 0; color: #c9c9c4; }
.notes ul { list-style: none; margin: 0; padding: 0; }
.notes li { padding: 9px 0; border-bottom: 1px solid var(--line); color: #c9c9c4; }

/* ---------- sheet (picker) ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet header { display: flex; align-items: center; gap: 10px; padding: 12px 16px 4px; max-width: 560px; width: 100%; margin: 0 auto; }
.sheet header .grow { flex: 1; font-weight: 800; font-size: 18px; }
.sheet .body { flex: 1; overflow-y: auto; padding: 0 16px calc(env(safe-area-inset-bottom) + 24px); max-width: 560px; width: 100%; margin: 0 auto; }
.sheet .choice { display: grid; gap: 10px; margin-top: 24px; }
.pickrow { display: flex; justify-content: space-between; align-items: center; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 14px 4px; text-align: left; }
.pickrow .name { font-weight: 650; }

/* ---------- EMOM timer ---------- */
.emom {
  position: fixed; inset: 0; z-index: 50;
  background: #000;
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 16px) 20px calc(env(safe-area-inset-bottom) + 20px);
}
.emom .top { display: flex; justify-content: space-between; align-items: center; }
.emom .clock {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center;
}
.emom .secs {
  font-family: var(--display);
  font-weight: 900;
  font-size: min(48vw, 300px);
  line-height: .9;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.emom.last3 .secs { color: var(--pr); }
.emom .station { font-size: 30px; font-weight: 800; margin-top: 12px; line-height: 1.15; }
.emom .rx { font-family: var(--display); font-size: 24px; font-weight: 800; color: var(--accent); margin-top: 4px; }
.emom .next { color: var(--muted); margin-top: 18px; font-size: 15px; }
.emom .meta { display: flex; justify-content: center; gap: 28px; margin-bottom: 18px; }
.emom .meta .num { font-size: 30px; display: block; text-align: center; }
.emom .controls { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.emom .bar { height: 6px; background: #1a1a1a; border-radius: 3px; overflow: hidden; margin-bottom: 18px; }
.emom .bar i { display: block; height: 100%; background: var(--accent); width: 0; }

/* ---------- misc ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px);
  transform: translateX(-50%);
  z-index: 60;
  background: var(--text);
  color: var(--bg);
  font-weight: 650;
  padding: 10px 16px;
  border-radius: 12px;
  max-width: calc(100% - 32px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}
.toast.err { background: var(--danger); color: #fff; }
.empty-state { text-align: center; color: var(--muted); padding: 40px 16px; }
.spacer { height: 12px; }

.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login { width: 100%; max-width: 340px; display: grid; gap: 12px; }
.login input { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; font-size: 18px; outline: none; }
.login input:focus { border-color: var(--accent); }
.wordmark { font-family: var(--display); font-weight: 900; font-size: 56px; letter-spacing: -.04em; line-height: 1; margin-bottom: 12px; }
.wordmark span { color: var(--accent); }
.error { color: var(--danger); margin: 0; }
