*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }

:root {
  color-scheme: light;
  --ground:      #EEF0F4;
  --surface:     #FFFFFF;
  --surface-2:   #E4E7ED;
  --line:        #D2D7E0;
  --line-soft:   #E3E7EE;
  --ink:         #131822;
  --ink-2:       #596273;
  --ink-3:       #8A93A3;
  --accent:      #1D5FB4;
  --accent-ink:  #FFFFFF;
  --peter:       #1D5FB4;
  --peter-ink:   #164A91;
  --peter-soft:  #DDE8F8;
  --sose:        #D99400;
  --sose-ink:    #8A5A00;
  --sose-soft:   #FAEDCF;
  --pr:          #1C7F49;
  --pr-soft:     #D8EFE1;
  --cardio:      #C2384B;
  --cardio-soft: #F7DDE1;
  --warn:        #B23A2C;
  --shadow:      0 1px 2px rgba(19, 24, 34, .06), 0 6px 18px rgba(19, 24, 34, .07);
  --shadow-lift: 0 2px 4px rgba(19, 24, 34, .08), 0 12px 32px rgba(19, 24, 34, .14);
  --r:  14px;
  --r-s: 9px;
  --display: 'Barlow Condensed', 'Arial Narrow', Helvetica, sans-serif;
  --body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground:     #0E1116;
    --surface:    #171B23;
    --surface-2:  #212734;
    --line:       #2B3341;
    --line-soft:  #232A36;
    --ink:        #E9EDF4;
    --ink-2:      #98A3B5;
    --ink-3:      #6E7889;
    --accent:     #5B9BF0;
    --accent-ink: #08111F;
    --peter:      #5B9BF0;
    --peter-ink:  #8FBDF7;
    --peter-soft: #16263D;
    --sose:       #F0B429;
    --sose-ink:   #F0B429;
    --sose-soft:  #362A11;
    --pr:         #3FB56B;
    --pr-soft:    #12301F;
    --cardio:     #F2637A;
    --cardio-soft:#3A1B22;
    --warn:       #E5786B;
    --shadow:      0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .5), 0 12px 32px rgba(0, 0, 0, .45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground:     #0E1116;
  --surface:    #171B23;
  --surface-2:  #212734;
  --line:       #2B3341;
  --line-soft:  #232A36;
  --ink:        #E9EDF4;
  --ink-2:      #98A3B5;
  --ink-3:      #6E7889;
  --accent:     #5B9BF0;
  --accent-ink: #08111F;
  --peter:      #5B9BF0;
  --peter-ink:  #8FBDF7;
  --peter-soft: #16263D;
  --sose:       #F0B429;
  --sose-ink:   #F0B429;
  --sose-soft:  #362A11;
  --pr:         #3FB56B;
  --pr-soft:    #12301F;
  --cardio:     #F2637A;
  --cardio-soft:#3A1B22;
  --warn:       #E5786B;
  --shadow:      0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .5), 0 12px 32px rgba(0, 0, 0, .45);
}

body {
  /* Disables the double-tap-to-zoom gesture app-wide (pinch zoom still works),
     so rapid taps on the steppers cannot zoom the page. */
  touch-action: manipulation;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button {
  cursor: pointer; border: 0; background: none;
  /* Without this, iOS waits for a possible double-tap and zooms when +/- is
     tapped quickly. :active still gives the press feedback. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 14px 108px; }

/* ---------- type ---------- */
.eyebrow {
  font-family: var(--display);
  font-weight: 600; font-size: 12px; letter-spacing: .13em;
  text-transform: uppercase; color: var(--ink-3);
}
.num { font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-in {
  max-width: 560px; margin: 0 auto; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.brand { font-family: var(--display); font-weight: 700; font-size: 21px; letter-spacing: .01em; line-height: 1; }
.brand span { color: var(--ink-3); font-weight: 600; }
.spacer { flex: 1; }

.whochip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px 5px 7px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
}
.whochip .dot { width: 9px; height: 9px; border-radius: 50%; }
.who-peter { background: var(--peter-soft); color: var(--peter-ink); border-color: color-mix(in srgb, var(--peter) 26%, transparent); }
.who-peter .dot { background: var(--peter); }
.who-sose  { background: var(--sose-soft);  color: var(--sose-ink);  border-color: color-mix(in srgb, var(--sose) 30%, transparent); }
.who-sose .dot { background: var(--sose); }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.pad { padding: 16px; }

.section-head { display: flex; align-items: baseline; gap: 10px; margin: 22px 2px 10px; }
.section-head .eyebrow { flex: 1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border-radius: var(--r-s);
  font-weight: 600; font-size: 15px;
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line);
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-block { width: 100%; }
.btn-lg { padding: 17px 20px; font-size: 16px; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-danger { background: transparent; border-color: transparent; color: var(--warn); }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------- start / rest state ---------- */
.hero { padding: 22px 18px; text-align: center; }
.hero h2 { font-family: var(--display); font-weight: 700; font-size: 30px; margin: 0 0 4px; letter-spacing: .005em; }
.hero p { margin: 0 0 18px; color: var(--ink-2); font-size: 14px; }

/* ---------- live session bar ---------- */
.livebar {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-radius: var(--r); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line-soft); box-shadow: var(--shadow);
}
.livebar > div { padding: 12px 8px; text-align: center; border-right: 1px solid var(--line-soft); }
.livebar > div:last-child { border-right: 0; }
.livebar .v { font-family: var(--display); font-weight: 700; font-size: 26px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.livebar .k { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-top: 2px; }

/* ---------- exercise card ---------- */
.ex {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden;
}
.ex.is-active { border-color: color-mix(in srgb, var(--accent) 42%, transparent); box-shadow: var(--shadow-lift); }
.ex-head { display: flex; align-items: center; gap: 10px; padding: 13px 14px; width: 100%; text-align: left; }
.ex-head .grow { display: block; flex: 1; min-width: 0; }
.ex-name { display: block; font-weight: 600; font-size: 15.5px; line-height: 1.25; }
.ex-last { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.ex-count {
  font-family: var(--display); font-weight: 700; font-size: 15px;
  color: var(--ink-2); background: var(--surface-2);
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 13px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-s); padding: 5px 9px;
  font-family: var(--display); font-weight: 600; font-size: 15px;
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
}
.chip.pr { background: var(--pr-soft); border-color: color-mix(in srgb, var(--pr) 30%, transparent); color: var(--pr); }
.chip .x { color: var(--ink-3); font-family: var(--body); font-size: 15px; line-height: 1; padding: 0 1px; }
.chip .x:hover { color: var(--warn); }

.ex-body { border-top: 1px solid var(--line-soft); padding: 14px; background: color-mix(in srgb, var(--surface-2) 40%, var(--surface)); }

.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* Grid items default to min-width:auto, which lets content force a track wider
   than its share and push the second stepper off screen. */
.stepper { text-align: center; min-width: 0; }
.stepper .lbl { font-size: 10.5px; letter-spacing: .11em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; }
.stepper .row { display: flex; align-items: center; gap: 6px; }
.step-btn {
  width: clamp(38px, 11vw, 46px); height: 50px; flex: 0 0 auto; border-radius: var(--r-s);
  background: var(--surface); border: 1px solid var(--line);
  font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1;
  color: var(--ink-2);
}
.step-btn:active { background: var(--surface-2); }
.step-val {
  /* flex-basis 0 + width 0 is what actually lets a number input shrink in a
     flex row on iOS; min-width alone is not enough there. */
  flex: 1 1 0; width: 0; min-width: 0;
  height: 50px; text-align: center;
  border-radius: var(--r-s); border: 1px solid var(--line); background: var(--surface);
  font-family: var(--display); font-weight: 700;
  font-size: clamp(21px, 5.6vw, 30px);
  font-variant-numeric: tabular-nums; color: var(--ink); padding: 0 2px;
}
.step-val::-webkit-outer-spin-button, .step-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step-val[type=number] { -moz-appearance: textfield; }
.unit { font-size: 11px; color: var(--ink-3); margin-top: 5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }

.logrow { display: flex; gap: 10px; margin-top: 13px; align-items: stretch; }
.logrow .btn { flex: 1; }
.rest {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 78px; padding: 0 10px; border-radius: var(--r-s);
  background: var(--surface); border: 1px solid var(--line);
}
.rest .v { font-family: var(--display); font-weight: 700; font-size: 21px; font-variant-numeric: tabular-nums; line-height: 1; }
.rest .k { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-top: 3px; }

/* ---------- history ---------- */
.sess { display: flex; gap: 0; overflow: hidden; }
.sess .stripe { width: 4px; flex: none; }
.sess .body { flex: 1; padding: 13px 14px; min-width: 0; }
.sess-top { display: flex; align-items: baseline; gap: 8px; }
.sess-date { font-family: var(--display); font-weight: 700; font-size: 18px; }
.sess-who { font-size: 12px; font-weight: 600; }
.sess-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.sess-lines { margin-top: 9px; display: flex; flex-direction: column; gap: 5px; }
.sess-line { display: flex; gap: 10px; font-size: 13.5px; }
.sess-line b { font-weight: 500; flex: 1; min-width: 0; }
.sess-line span { color: var(--ink-2); font-family: var(--display); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- records ---------- */
.rec { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.rec-name { font-weight: 600; font-size: 14.5px; }
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vs-cell { border-radius: var(--r-s); padding: 8px 10px; border: 1px solid transparent; }
.vs-p { background: var(--peter-soft); border-color: color-mix(in srgb, var(--peter) 22%, transparent); }
.vs-s { background: var(--sose-soft);  border-color: color-mix(in srgb, var(--sose) 26%, transparent); }
.vs-cell .who { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.vs-p .who { color: var(--peter-ink); } .vs-s .who { color: var(--sose-ink); }
.vs-cell .best { font-family: var(--display); font-weight: 700; font-size: 23px; line-height: 1.15; font-variant-numeric: tabular-nums; margin-top: 1px; }
.vs-cell .sub { font-size: 11.5px; color: var(--ink-2); }
.vs-cell.empty { background: var(--surface-2); border-color: var(--line-soft); }
.vs-cell.empty .best { color: var(--ink-3); font-weight: 600; font-size: 18px; }
.crown { display: inline-block; margin-left: 5px; font-size: 11px; color: var(--pr); font-weight: 700; letter-spacing: .06em; }

/* ---------- week summary ---------- */
.week { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.week-cell { padding: 13px 14px; }
.week-cell .who { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; margin-bottom: 6px; }
.week-cell .big { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.week-cell .big small { font-size: 14px; color: var(--ink-3); font-weight: 600; margin-left: 3px; }
.week-cell .sub { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; }
.bar { height: 5px; border-radius: 3px; background: var(--surface-2); margin-top: 9px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; }

/* ---------- empty ---------- */
.empty-note { text-align: center; padding: 30px 20px; color: var(--ink-3); font-size: 14px; }

/* ---------- bottom nav ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); }
.nav button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 10px; color: var(--ink-3);
  font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
}
.nav button svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav button.on { color: var(--accent); }

/* ---------- sheet ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 14, 20, .5);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 86vh;
  background: var(--surface); border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lift);
  animation: rise .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes rise { from { transform: translateY(22px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .btn { transition: none; } }
.sheet-head { padding: 15px 16px 11px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.sheet-head h3 { font-family: var(--display); font-weight: 700; font-size: 21px; margin: 0; flex: 1; }
.sheet-body { overflow-y: auto; padding: 6px 0 max(16px, env(safe-area-inset-bottom, 0px)); -webkit-overflow-scrolling: touch; }
.search {
  width: 100%; padding: 12px 14px; border-radius: var(--r-s);
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: 16px;   /* 16px or more, or iOS zooms the page on focus */
}
.grp { padding: 14px 16px 5px; }
.opt {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft); font-size: 15px;
}
.opt:active { background: var(--surface-2); }
.opt .meta { margin-left: auto; color: var(--ink-3); font-family: var(--display); font-weight: 600; font-size: 14px; }
.opt.added { color: var(--ink-3); }

.who-pick { display: grid; gap: 12px; padding: 4px 0 8px; }
.who-btn { padding: 20px; border-radius: var(--r); text-align: left; border: 1px solid transparent; }
.who-btn .n { display: block; font-family: var(--display); font-weight: 700; font-size: 27px; line-height: 1; }
.who-btn .d { display: block; font-size: 12.5px; margin-top: 4px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(78px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  background: var(--ink); color: var(--ground);
  padding: 10px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lift); max-width: 90vw; text-align: center;
}
.toast.good { background: var(--pr); color: #fff; }
.toast.bad { background: var(--warn); color: #fff; }

.field { display: flex; flex-direction: column; gap: 6px; padding: 0 16px 14px; }
.field label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.field input, .field select {
  padding: 12px 13px; border-radius: var(--r-s); border: 1px solid var(--line);
  background: var(--surface-2); font-size: 16px; width: 100%;
}
.ro-note { font-size: 12.5px; color: var(--ink-3); padding: 10px 2px 0; text-align: center; }

/* ---------- sign in ---------- */
.signin { max-width: 380px; margin: 0 auto; padding: 12vh 18px 40px; }
.signin .mark {
  font-family: var(--display); font-weight: 700; font-size: 46px; line-height: 1;
  letter-spacing: .01em; text-align: center;
}
.signin .mark span { color: var(--ink-3); font-weight: 600; }
.signin .tag { text-align: center; color: var(--ink-2); font-size: 14px; margin: 6px 0 26px; }
.signin .card { padding: 18px; }
.pick2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.pick2 button {
  padding: 13px 8px; border-radius: var(--r-s); border: 1px solid var(--line);
  background: var(--surface-2); font-family: var(--display); font-weight: 700; font-size: 20px;
  color: var(--ink-2);
}
.pick2 button.on { border-color: transparent; }
.pick2 button.on.p { background: var(--peter-soft); color: var(--peter-ink); box-shadow: inset 0 0 0 1.5px var(--peter); }
.pick2 button.on.s { background: var(--sose-soft); color: var(--sose-ink); box-shadow: inset 0 0 0 1.5px var(--sose); }
.pw { width: 100%; padding: 14px 13px; border-radius: var(--r-s); border: 1px solid var(--line);
  background: var(--surface-2); font-size: 16px; margin-bottom: 10px; }
.err { color: var(--warn); font-size: 13.5px; text-align: center; margin: 10px 0 0; min-height: 18px; }

/* ---------- sync / offline chip ---------- */
.sync {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line-soft);
}
.sync.off { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.sync .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.menu-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); width: 100%; text-align: left; font-size: 15px; }
.menu-row.danger { color: var(--warn); }

/* ---------- logging for the other person ---------- */
.forwho { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 13px; }
.forwho button {
  padding: 9px 8px; border-radius: var(--r-s); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-3);
  font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: .01em;
}
.forwho button.on { border-color: transparent; }
.forwho button.on.p { background: var(--peter-soft); color: var(--peter-ink); box-shadow: inset 0 0 0 1.5px var(--peter); }
.forwho button.on.s { background: var(--sose-soft);  color: var(--sose-ink);  box-shadow: inset 0 0 0 1.5px var(--sose); }

.chiprow { display: flex; align-items: flex-start; gap: 8px; padding: 0 14px; }
.chiprow + .chiprow { margin-top: 2px; }
.chiprow:last-child { padding-bottom: 13px; }
.chiprow .chips { padding: 0 0 4px; flex: 1; min-width: 0; }
.chiptag {
  flex: none; margin-top: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid transparent;
}

.alsofor {
  margin: -4px 2px 0; font-size: 12.5px; color: var(--ink-3); text-align: center;
}

/* ---------- body map ---------- */
.bodypick { margin: 0 0 12px; }
.bodycard { padding: 14px 10px 12px; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chartbox { position: relative; display: flex; flex-direction: column; align-items: center; }
.chartbox > div { width: 100%; }
.chartbox svg, .body-chart-svg { width: 100%; height: auto; display: block; }
.chartlbl {
  margin-top: 4px; font-size: 10.5px; letter-spacing: .11em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
/* The package paints the silhouette and outlines with fixed slate values; these
   are presentation attributes, so plain CSS re-themes them. */
.body-chart-background path { fill: var(--surface-2); }
.body-chart-muscle { stroke: color-mix(in srgb, var(--ink) 22%, transparent); }

.legend {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px;
  margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line-soft);
}
.legend .lg { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-3); font-weight: 500; }
.legend i { width: 13px; height: 13px; border-radius: 3px; border: 1px solid var(--line-soft); }

.coldrow {
  display: flex; align-items: baseline; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft); font-size: 14px;
}
.coldrow:last-child { border-bottom: 0; }
.coldrow span:first-child { flex: 1; min-width: 0; }
.coldrow .ago {
  font-family: var(--display); font-weight: 600; font-size: 15px;
  color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.coldrow .ago.never { color: var(--ink-3); font-style: italic; font-family: var(--body); font-size: 12.5px; }
.minor {
  font-style: normal; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); margin-left: 7px; font-weight: 600;
}

.detail { margin-top: 12px; overflow: hidden; }
.detail-top {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line-soft);
}
.detail-name { font-weight: 600; font-size: 15px; }
.detail-ago { flex: 1; font-size: 12.5px; color: var(--ink-3); }
.detail-list { max-height: 260px; overflow-y: auto; }

.mapnote { font-size: 12px; color: var(--ink-3); margin: 0; padding: 10px 14px 12px; }
.mapnote code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.credit { text-align: center; font-size: 11.5px; color: var(--ink-3); margin: 18px 0 0; }
.credit a { color: var(--ink-2); }
.neverrow { align-items: flex-start; }
.neverrow .ago.never {
  white-space: normal; text-align: right; max-width: 68%; line-height: 1.4;
  font-style: normal;
}

/* ---------- cardio heart ---------- */
.heartcard { display: flex; align-items: center; gap: 15px; padding: 15px 16px; margin-bottom: 12px; }
.heartwrap { flex: none; width: 62px; height: 62px; }
.heart { width: 100%; height: 100%; display: block; overflow: visible; }
.heart-bg   { fill: var(--surface-2); }
.heart-fill { fill: var(--cardio); transition: y .5s ease, height .5s ease; }
.heart-line { fill: none; stroke: var(--cardio); stroke-width: .9; stroke-linejoin: round; opacity: .85; }
.heartwrap.beating { animation: beat 2.4s ease-in-out infinite; transform-origin: center; }
@keyframes beat {
  0%, 62%, 100% { transform: scale(1); }
  70%  { transform: scale(1.07); }
  78%  { transform: scale(1.01); }
  86%  { transform: scale(1.05); }
}
@media (prefers-reduced-motion: reduce) { .heartwrap.beating { animation: none; } }

.heartinfo { flex: 1; min-width: 0; }
.heartnum {
  font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--cardio);
}
.heartnum small { font-size: 14px; color: var(--ink-3); font-weight: 600; }
.heartsub  { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.heartlast { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---------- backdating ---------- */
.alsofor.backdated { color: var(--ink-2); }
.alsofor.backdated b { color: var(--ink); font-weight: 600; }
.linkbtn {
  color: var(--accent); font: inherit; text-decoration: underline;
  text-underline-offset: 2px; padding: 0;
}

/* ---------- units ---------- */
.u {
  font-style: normal; font-size: .68em; font-weight: 600;
  color: var(--ink-3); margin-left: 3px; letter-spacing: .02em;
}
.chip .u { color: color-mix(in srgb, currentColor 55%, transparent); }
.vs-cell .best .u { color: color-mix(in srgb, currentColor 55%, transparent); }
.ex-count .u { margin-left: 3px; }

/* ---------- routines ---------- */
.routine-intro { font-size: 13.5px; color: var(--ink-2); margin: 0 2px 12px; line-height: 1.5; }
.routine { overflow: hidden; }
.routine.is-open { box-shadow: var(--shadow-lift); }
.routine-head { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; padding: 15px 15px 13px; }
.routine-head .grow { display: block; flex: 1; min-width: 0; }
.routine-day {
  display: block; font-size: 10.5px; letter-spacing: .11em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700;
}
.routine-name { display: block; font-family: var(--display); font-weight: 700; font-size: 27px; line-height: 1.05; margin-top: 1px; }
.routine-meta { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 4px; line-height: 1.45; }
.chev { flex: none; color: var(--ink-3); font-size: 15px; line-height: 1; padding-top: 6px; }

.grouprow { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 9px; }
.gchip {
  font-size: 10.5px; font-weight: 600; letter-spacing: .03em;
  padding: 3px 7px; border-radius: 5px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-soft);
}

.routine-body { border-top: 1px solid var(--line-soft); padding: 4px 15px 6px;
  background: color-mix(in srgb, var(--surface-2) 40%, var(--surface)); }
.rsec { padding: 12px 0; }
.rsec-t {
  font-family: var(--display); font-weight: 600; font-size: 13px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px;
}
.rsec ul { margin: 0; padding-left: 17px; }
.rsec li { font-size: 13.5px; color: var(--ink-2); line-height: 1.65; }
.rampup {
  font-size: 12.5px; color: var(--ink); margin: 0 0 4px;
  padding: 9px 11px; border-radius: var(--r-s);
  background: var(--surface-2); border: 1px dashed var(--line);
}
.rrow { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.rrow:last-child { border-bottom: 0; }
.rrow .grow { display: block; flex: 1; min-width: 0; }
.rrow-name { display: block; font-weight: 600; font-size: 14px; }
.rrow-meta { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.rrow-note { display: block; font-size: 11.5px; color: var(--ink-3); font-style: italic; margin-top: 3px; }
.rbadge {
  flex: none; font-family: var(--display); font-weight: 700; font-size: 16px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-s); padding: 5px 9px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.opt-tag {
  display: inline-block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 5px; margin-bottom: 3px; font-weight: 700;
}
.routine-foot { padding: 12px 15px 14px; border-top: 1px solid var(--line-soft); }

.ex-target { display: block; font-size: 11.5px; color: var(--accent); margin-top: 3px; font-weight: 500; }
.ex-count.met { background: var(--pr-soft); color: var(--pr); }
.idle-alt { display: flex; gap: 8px; margin-top: 8px; }
.idle-alt .btn { flex: 1; padding: 11px 8px; font-size: 13.5px; }
.alsofor.routinetag b { color: var(--accent); }

/* five tabs need slightly tighter labels */
.nav button { font-size: 9.5px; letter-spacing: .05em; }
.nav button svg { width: 21px; height: 21px; }

/* On a 320px-wide iPhone (SE, or any phone with Display Zoom on) two steppers
   side by side leave the input too narrow for a four-character weight, so they
   stack instead. */
@media (max-width: 359px) {
  .steppers { grid-template-columns: 1fr; gap: 12px; }
  .step-val { font-size: 28px; }
  .step-btn { width: 52px; }
}
.rampup.finisher { margin-top: 10px; border-style: solid; border-color: var(--line-soft); }
/* A hold has a single control, so it takes the full width. */
.steppers.one { grid-template-columns: 1fr; }
