/* GSPX design system — athletic instrument-panel dark UI.
   Rules (from design research): elevation instead of borders; selection = surface step-up +
   trailing check, never partial accent borders; radius has a point of view (pill controls,
   4px cards); red is rationed to primary action / live state / key data; tracked-caps labels
   over quiet sentence-case body; big tabular numerals with whispered units. */
:root {
  --bg: #0a0a0c;
  --surface: #151518;          /* raised */
  --surface2: #1f1f24;         /* selected / overlay */
  --divider: rgba(245, 243, 238, .08);
  --edge2: #2c2c33;
  --text: #f5f3ee;
  --dim: rgba(245, 243, 238, .62);
  --faint: rgba(245, 243, 238, .40);
  --accent: #e5402a;
  --accent-text: #ff6a55;      /* lightened red: passes contrast for small text on black */
  --go: #56b787;
  --warn: #d2a24a;
  --lvl0: #56b787;
  --lvl1: #5aa4d4;
  --lvl2: #d2a24a;
  --lvl3: #de5d47;
  --r-card: 4px;
  --r-pill: 999px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100%; position: relative; }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* type system: condensed display for numerals/titles, tracked caps for labels */
.display, .score-num, .rest-clock, .timer-ring span, .ex-name, .page-head h1,
.done h1, .stat b, .cta, .test-title, .hero-stats b, #time-chips .chip {
  font-family: 'Avenir Next Condensed', 'HelveticaNeue-CondensedBold', 'Arial Narrow', 'Roboto Condensed', -apple-system, sans-serif;
  font-weight: 700;
}
.score-num, .rest-clock, .timer-ring span, .clock, .stat b { font-variant-numeric: tabular-nums; }

/* top padding respects the device status-bar inset (needed once installed as a PWA, where
   there's no Safari chrome above the content). Falls back to 0 inset in a normal browser tab. */
.screen { padding: calc(24px + env(safe-area-inset-top)) 18px 100px; }
.ic { width: 22px; height: 22px; display: block; }

/* ---------- HOME ---------- */
.hero { display: flex; align-items: flex-end; justify-content: space-between; padding: 6px 2px 28px; margin-bottom: 8px; }
.score-dial { display: flex; flex-direction: column; }
.score-num { font-size: clamp(44px, 15vw, 62px); line-height: 0.92; }
.score-label { font-size: 10px; letter-spacing: 3px; color: var(--faint); margin-top: 8px; font-weight: 600; }
.hero-stats { display: flex; flex-direction: column; gap: 8px; text-align: right; }
.hero-stats div { display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; }
.hero-stats b { font-size: 19px; }
.hero-stats span { color: var(--dim); font-size: 12px; }

.card {
  background: var(--surface); border-radius: var(--r-card);
  padding: 20px 18px; margin-bottom: 12px; width: 100%; text-align: left;
}
.card h2 {
  font-size: 12px; letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--dim); margin-bottom: 14px; font-weight: 600;
}

.test-wrap { position: relative; }
.test-card { padding-right: 48px; transition: background .18s ease-out; }
.test-card:active { background: var(--surface2); }
.test-title { font-size: 19px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.test-sub { color: var(--dim); font-size: 13px; line-height: 1.5; }
.test-dismiss {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px;
  color: var(--faint); font-size: 22px; line-height: 1;
}
.test-dismiss:active { color: var(--text); }

/* time picker: pill segmented control, selected inverts */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
#time-chips {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  background: var(--bg); border-radius: var(--r-pill); padding: 4px;
}
#time-chips .chip {
  border: none; border-radius: var(--r-pill); justify-content: center;
  padding: 11px 0; background: transparent; color: var(--dim);
  font-size: 16px; transition: background .18s ease-out, color .18s ease-out;
}
#time-chips .chip.on { background: var(--text); color: var(--bg); }
#time-chips .chip.on small { color: var(--bg); opacity: 0.6; }

.chip {
  background: transparent; border: 1px solid var(--edge2); border-radius: var(--r-pill);
  padding: 10px 16px; font-size: 14px; font-weight: 600; display: flex; align-items: baseline; gap: 4px;
  color: var(--dim); transition: all .18s ease-out;
}
.chip small { font-size: 11px; color: var(--dim); font-weight: 500; }
.chip.on { border-color: transparent; background: var(--surface2); color: var(--text); }

/* focus + mode: flat list rows, selection = surface step-up + trailing red check */
.focus-chips { flex-direction: column; gap: 0; border-radius: var(--r-card); overflow: hidden; }
.chip.focus {
  width: 100%; justify-content: flex-start; align-items: center; gap: 10px;
  border: none; border-radius: 0; padding: 15px 16px; color: var(--dim);
  position: relative; background: transparent;
}
.chip.focus + .chip.focus { border-top: 1px solid var(--divider); }
.chip.focus.on { background: var(--surface2); color: var(--text); }
.chip.focus.on::after {
  content: ''; margin-left: auto; width: 16px; height: 16px; flex-shrink: 0;
  background-color: var(--accent-text);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 12.5 10 18 19.5 7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 12.5 10 18 19.5 7'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chip.focus em { margin-left: auto; font-style: normal; font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--go); font-weight: 700; }
.chip.focus.on em { margin-left: 0; margin-right: 10px; }
.mode-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.mode-text b { font-size: 15px; }
.mode-text small { font-size: 11.5px; color: var(--dim); font-weight: 400; }

.hint { color: var(--faint); font-size: 12px; margin-top: 12px; line-height: 1.55; }
.hint-inline { color: var(--faint); font-size: 11px; text-transform: none; letter-spacing: 0; font-weight: 500; }

.cta {
  display: block; width: 100%; padding: 17px; border-radius: var(--r-pill); margin: 22px 0 10px;
  background: var(--accent); color: #fff;
  font-size: 16px; letter-spacing: 2.5px; text-transform: uppercase;
  transition: background .15s ease-out;
}
.cta:active { background: #c33a26; }
.science-note { color: var(--faint); font-size: 12px; line-height: 1.6; padding: 4px 4px 0; }

/* ---------- NAV ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; display: flex;
  background: rgba(10, 10, 12, .94); backdrop-filter: blur(14px);
  border-top: 1px solid var(--divider); padding: 10px 0 max(12px, env(safe-area-inset-bottom));
}
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--faint); position: relative; transition: color .15s ease-out; }
.nav-btn span { font-size: 9.5px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 600; }
.nav-btn.active { color: var(--text); }
.nav-btn.active::before { content: ''; position: absolute; top: -11px; width: 22px; height: 2px; background: var(--accent); }

/* ---------- PAGE HEADS ---------- */
.page-head { display: flex; align-items: center; gap: 12px; padding: 4px 2px 22px; }
.page-head h1 { font-size: 28px; letter-spacing: 0.5px; text-transform: uppercase; line-height: 1; }
.page-head p { color: var(--dim); font-size: 13px; margin-top: 6px; line-height: 1.4; }
.back { font-size: 30px; color: var(--dim); line-height: 1; padding: 0 8px 4px 0; }

/* ---------- PREVIEW ---------- */
.preview-list { display: flex; flex-direction: column; gap: 8px; }
.round-divider {
  color: var(--faint); font-size: 11px; letter-spacing: 2px; font-weight: 600;
  text-transform: uppercase; padding: 18px 2px 4px;
}
.ex-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: var(--r-card); padding: 10px 12px;
}
.ex-info { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.ex-info b { font-size: 15px; }
.swap { font-size: 17px; color: var(--dim); width: 38px; height: 38px; border-radius: var(--r-pill); background: var(--surface2); display: flex; align-items: center; justify-content: center; }
.swap:active { color: var(--text); background: var(--edge2); }

.mini-fig { width: 54px; height: 54px; flex-shrink: 0; background: var(--surface2); border-radius: var(--r-card); }

.lvl { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.lvl-0 { color: var(--lvl0); } .lvl-1 { color: var(--lvl1); } .lvl-2 { color: var(--lvl2); } .lvl-3 { color: var(--lvl3); }

/* ---------- FIGURE ---------- */
svg .fig-ground { stroke: var(--edge2); stroke-width: 1.2; stroke-linecap: round; }
svg .fig-torso, svg .fig-limb { fill: none; stroke-width: 4.2; stroke-linecap: round; stroke-linejoin: round; }
svg .fig-front .fig-limb, svg .fig-torso { stroke: var(--text); }
svg .fig-back .fig-limb { stroke: #4a4a55; }
svg .fig-head { fill: var(--accent); }
svg .fig-prop-shape { fill: var(--surface2); stroke: var(--edge2); }
svg .fig-prop-line { stroke: var(--edge2); stroke-width: 2; }
svg .fig-prop-db { stroke: var(--warn); stroke-width: 4; stroke-linecap: round; }
svg .fig-prop-band { fill: none; stroke: var(--go); stroke-width: 1.6; opacity: .8; }

/* ---------- PLAYER ---------- */
.player { display: flex; flex-direction: column; min-height: 100vh; padding-bottom: 20px; }
.player-top { display: flex; align-items: center; gap: 12px; padding: 6px 2px 16px; }
.player-top-mid { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.mode-tag { font-size: 9px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--faint); font-weight: 700; text-align: center; }
.quit { font-size: 26px; color: var(--dim); padding: 0 10px 4px; line-height: 1; }
.progress-track { height: 3px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .3s linear; }
.clock { font-weight: 700; color: var(--dim); font-size: 14px; }

.player-stage { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%; }

/* Phase label: colored text, no band — each phase gets its own accent so it stays legible at a glance */
.seg-label {
  font-size: 12px; letter-spacing: 3.5px; font-weight: 700; text-transform: uppercase;
  color: var(--accent-text); margin-bottom: 12px;
}
.seg-label.warmup { color: var(--warn); }
.seg-label.cooldown, .seg-label.rest, .seg-label.recovery { color: var(--go); }
.ex-name { font-size: clamp(23px, 7.5vw, 32px); letter-spacing: 0; text-transform: uppercase; margin-bottom: 14px; padding: 0 10px; line-height: 1.05; }

/* Full-bleed exercise animation */
.fig-wrap { position: relative; width: calc(100% + 36px); margin: 0 -18px; display: flex; justify-content: center; background: var(--surface); }
.fig-wrap svg#main-fig { width: 100%; max-width: 62vh; aspect-ratio: 1; background: var(--surface); border-radius: 0; }

/* signature detail: depleting red timer ring (--p = fraction of interval remaining, 0..100) */
.timer-ring {
  position: absolute; right: 12px; top: 12px;
  width: clamp(60px, 19vw, 78px); height: clamp(60px, 19vw, 78px); border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p, 100) * 1%), var(--surface2) 0);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .45);
}
.timer-ring::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--bg); }
.timer-ring span { position: relative; font-size: clamp(25px, 8vw, 32px); }
.side-note { margin-top: 12px; font-size: 11px; font-weight: 700; letter-spacing: 2.5px; color: var(--warn); text-transform: uppercase; }

.cues { list-style: none; margin: 16px 0 6px; display: flex; flex-direction: column; gap: 6px; }
.cues li { color: var(--dim); font-size: 14px; }

.next-up { color: var(--faint); font-size: 12px; margin-top: auto; padding-top: 16px; }
.player-controls { display: flex; gap: 10px; margin-top: 14px; width: 100%; }
.player-controls button {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--surface); border-radius: var(--r-pill);
  padding: 13px 8px; font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--dim);
  transition: background .15s ease-out, color .15s ease-out;
}
.player-controls .pl { min-width: 0; }
.player-controls .ic { width: 16px; height: 16px; flex-shrink: 0; }
.player-controls button:active { color: var(--text); background: var(--surface2); }

/* rest / touch-in */
.rest-clock { font-size: clamp(60px, 22vw, 92px); line-height: 1; margin: 2px 0 6px; }
.touchin { width: 100%; margin-top: 8px; }
.touchin p { color: var(--dim); font-size: 13px; margin-bottom: 10px; }
.touchin p b { color: var(--text); }
.touchin-btns { display: flex; gap: 8px; }
/* No fill/border — only the icon is colored. Icon top-left, label to its right, subtitle beneath. */
.ti {
  flex: 1; border-radius: var(--r-card); padding: 10px 8px;
  display: grid; grid-template-columns: auto 1fr; column-gap: 8px; row-gap: 1px;
  text-align: left; color: var(--text); background: none; border: none;
  transition: background .12s ease-out;
}
.ti .ic { grid-row: 1 / span 2; align-self: start; width: 22px; height: 22px; }
.ti b { grid-column: 2; align-self: center; font-size: 12px; font-weight: 700; letter-spacing: .5px; }
.ti small { grid-column: 2; font-size: 10px; color: var(--faint); font-weight: 400; letter-spacing: 0; line-height: 1.2; }
.ti.easy .ic { color: var(--lvl0); }
.ti.tough .ic { color: var(--lvl1); }
.ti.hard .ic { color: var(--lvl3); }
.ti:active { background: var(--surface2); }
.ti-learn { margin-top: 10px; color: var(--faint); font-size: 12px; padding: 8px; }
.touchin-done { color: var(--go); font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; margin: 18px 0; }
.touchin.compact { margin-top: 10px; }
.touchin.compact p { margin-bottom: 6px; font-size: 12px; }
.touchin.compact .ti { grid-template-columns: auto auto; justify-content: start; padding: 8px; }
.touchin.compact .ti .ic { grid-row: 1; width: 18px; height: 18px; }
.touchin.compact .ti small { display: none; }
.go-cta { margin: 14px 0 4px; padding: 15px; font-size: 18px; letter-spacing: 4px; }

.next-preview {
  display: flex; align-items: center; gap: 12px; margin-top: 16px;
  background: var(--surface); border-radius: var(--r-card); padding: 10px 14px; width: 100%;
}
.next-preview div { text-align: left; display: flex; flex-direction: column; gap: 2px; }
.next-preview span { font-size: 9px; letter-spacing: 2px; color: var(--faint); font-weight: 700; }
.next-preview b { font-size: 16px; }

/* ---------- DONE: instrument-panel stats, no boxes ---------- */
.done { text-align: center; padding-top: 56px; }
.done-burst {
  width: 74px; height: 74px; border-radius: 50%; border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 20px;
}
.done-burst .ic { width: 34px; height: 34px; color: var(--accent-text); }
.done h1 { font-size: 32px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 30px; }
.done-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.stat { text-align: center; padding: 18px 8px; margin-bottom: 0; background: none; border-radius: 0; }
.stat:nth-child(odd) { border-right: 1px solid var(--divider); }
.stat:nth-child(-n+2) { border-bottom: 1px solid var(--divider); }
.stat b { font-size: clamp(32px, 11vw, 46px); display: block; line-height: 1; }
.stat span { color: var(--faint); font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; display: block; margin-top: 8px; }
.done-fb { color: var(--dim); font-size: 13px; line-height: 1.6; margin: 22px 4px 8px; }
.stat span em { font-style: normal; color: var(--faint); }
.effort-ask { margin-top: 22px; }
.effort-ask p { color: var(--dim); font-size: 13px; margin-bottom: 10px; }
.effort-chips { justify-content: center; }
.cal-preview { color: var(--faint); font-size: 12px; margin-top: 4px; }

/* ---------- LIBRARY ---------- */
.cat-head { font-size: 12px; letter-spacing: 1.8px; text-transform: uppercase; color: var(--dim); margin: 28px 2px 10px; font-weight: 600; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.lib-card {
  background: var(--surface); border-radius: var(--r-card);
  padding: 14px 10px; display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center;
  transition: background .15s ease-out;
}
.lib-card:active { background: var(--surface2); }
.lib-card .mini-fig { width: 64px; height: 64px; }
.lib-card b { font-size: 13px; line-height: 1.3; }

/* Native-style bottom-sheet drawer: backdrop fades in, sheet slides up, drag the grip to dismiss. */
.modal-back {
  position: fixed; inset: 0; background: rgba(5, 5, 7, 0);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
  transition: background .28s ease;
}
.modal-back.show { background: rgba(5, 5, 7, .78); }
.drawer {
  background: var(--surface); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  position: relative; padding: 6px 22px max(24px, env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .34s cubic-bezier(.22, .61, .36, 1);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .5);
  will-change: transform;
}
.modal-back.show .drawer { transform: translateY(0); }
.drawer-grip {
  width: 40px; height: 5px; border-radius: 3px; background: var(--edge2);
  margin: 8px auto 14px; flex-shrink: 0; cursor: grab; touch-action: none;
}
.drawer-content { position: relative; }
.modal-x { position: absolute; top: 2px; right: 4px; width: 40px; height: 40px; font-size: 26px; color: var(--faint); z-index: 2; line-height: 1; }
.modal-fig { width: 150px; height: 150px; display: block; margin: 0 auto 12px; background: var(--surface2); border-radius: var(--r-card); }
.drawer h2 { text-align: center; font-size: 21px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.modal-meta { text-align: center; color: var(--faint); font-size: 12px; margin: 8px 0 18px; }
.variant-list { display: flex; flex-direction: column; gap: 8px; }
.variant { background: var(--surface2); border: 1.5px solid transparent; border-radius: var(--r-card); padding: 12px 14px; }
.variant.current { border-color: var(--accent); }
.v-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.v-head b { font-size: 15px; }
.v-head em { margin-left: auto; font-style: normal; font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent-text); font-weight: 700; }
.variant ul { list-style: none; }
.variant li { color: var(--dim); font-size: 13px; line-height: 1.55; }


/* ---------- STATS ---------- */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; }
.bar { width: 100%; min-height: 2px; background: var(--accent); border-radius: 1px 1px 0 0; }
.bar-col span { font-size: 9px; color: var(--faint); }

.area-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.area-row span { width: 56px; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }
.area-row b { width: 62px; text-align: right; font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; }
.area-track { flex: 1; height: 3px; background: var(--surface2); border-radius: 2px; }
.area-fill { height: 100%; background: var(--text); border-radius: 2px; }

.muscle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.muscle { padding: 10px 12px; background: var(--surface2); border-radius: var(--r-card); }
.muscle b { display: block; font-size: 12px; text-transform: capitalize; }
.muscle b::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--faint); }
.muscle.ready b::before { background: var(--go); }
.muscle.soon b::before { background: var(--warn); }
.muscle.resting b::before { background: var(--accent-text); }
.muscle span { font-size: 10px; color: var(--faint); margin-left: 13px; }

/* ---------- SETTINGS ---------- */
.toggle { display: flex; align-items: center; gap: 12px; padding: 11px 2px; font-size: 15px; cursor: pointer; }
.toggle input { width: 19px; height: 19px; accent-color: var(--accent); }
.row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.row input[type="range"] { flex: 1; accent-color: var(--accent); }
.row b { min-width: 64px; text-align: right; }
.row-label { width: 62px; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.8px; flex-shrink: 0; }
.sex-row { gap: 8px; }
.sex-row .chip { padding: 8px 14px; font-size: 13px; }
.danger { display: block; width: 100%; text-align: left; padding: 12px 4px; color: var(--accent-text); font-size: 14px; font-weight: 600; }
.data-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 13px 14px; margin-bottom: 8px; border-radius: var(--r-card);
  background: var(--surface2); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer;
}
.data-btn:active { background: var(--edge2); }
.data-btn .ic { width: 18px; height: 18px; color: var(--dim); flex-shrink: 0; }

.afterburn-note { color: var(--faint); font-size: 12px; line-height: 1.55; margin: 14px 8px 0; }

/* mid-workout pain flow */
.pain-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.pain-list .chip {
  align-items: flex-start; flex-direction: column; gap: 2px;
  padding: 14px 18px; text-align: left;
  background: var(--surface2); border: 1px solid transparent; border-radius: 10px;
}
.pain-list .chip small { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent-text); }
/* current-exercise culprit: subtle red-tinted fill, not a harsh full border */
.pain-list .chip.likely { background: rgba(229, 64, 42, .14); }
.pain-list .chip:active { background: var(--edge2); }
.pain-done-scope { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; }

/* ---------- RESPONSIVE ----------
   Small phones (<=360px): tighter paddings and controls.
   Vertical iPad / large screens (>=700px): wider canvas, roomier type. */
@media (max-width: 360px) {
  .screen { padding: calc(18px + env(safe-area-inset-top)) 12px 96px; }
  .fig-wrap { width: calc(100% + 24px); margin-left: -12px; margin-right: -12px; }
  .chip { padding: 9px 12px; font-size: 13px; }
  #time-chips .chip { font-size: 14px; padding: 10px 0; }
  .ti { padding: 11px 4px 10px; }
  .ti b { font-size: 11px; }
  .ti small { font-size: 9px; }
  .player-controls { gap: 6px; }
  .player-controls button { padding: 11px 4px; font-size: 11px; letter-spacing: 0.4px; gap: 5px; }
  .player-controls .ic { width: 15px; height: 15px; }
  .player-controls button { padding: 11px 18px; }
  .hero-stats span { font-size: 11px; }
}
@media (min-width: 700px) {
  #app { max-width: 680px; }
  .bottomnav { max-width: 680px; }
  .screen { padding: calc(32px + env(safe-area-inset-top)) 28px 110px; }
  .fig-wrap { width: calc(100% + 56px); margin-left: -28px; margin-right: -28px; }
  body { font-size: 17px; }
  .card { padding: 24px 22px; }
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .ex-name { font-size: 38px; }
  .cues li { font-size: 16px; }
  .mode-text b { font-size: 17px; }
  .mode-text small { font-size: 13px; }
  .chip.focus { padding: 17px 20px; font-size: 16px; }
}

/* body map */
#bodymap { width: 190px; max-width: 60%; display: block; margin: 6px auto; }
#bodymap .bm-body line, #bodymap .bm-body polyline, #bodymap .bm-body circle {
  stroke: var(--edge2); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round;
}
#bodymap .joint { fill: var(--surface2); stroke: var(--faint); stroke-width: 1.4; cursor: pointer; }
#bodymap .joint.on { fill: var(--accent); stroke: var(--text); }
