/* Gains Atlas — a dark stage, one warm light: the selected body part. Phone first, system fonts. */

:root {
  /* colour: three surfaces, three text tones, one ember */
  --page: #0d0b0b;
  --raised: #161312;
  --overlay: #0d0b0bf2;
  --thumb: #241e1c;
  --line: #2b2525;
  --hairline: #ffffff0d;
  --text: #f2ede9;
  --text-2: #a49c98;
  --faint: #8b837f;
  --ember: #ff5a1f;
  --ember-ink: #1a0d06;
  --focus: #ffb08a;
  --bar-off: #3a3230;

  /* shape: two radii */
  --r: 14px;
  --r-full: 999px;

  /* motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 140ms;
  --t-med: 220ms;

  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 22px;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body { padding-bottom: env(safe-area-inset-bottom); }

.shell { max-width: 620px; margin: 0 auto; padding: 0 16px 56px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h1, h2, p { margin: 0; }

/* the type scale: overline, meta, body, card title, h2, h1, display */
.overline {
  font-size: 13px; line-height: 16px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-2);
}
.eyebrow { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text-2); }

/* ------------------------------------------------------------------ top bar */

.topbar {
  max-width: 620px; margin: 0 auto;
  padding: calc(6px + env(safe-area-inset-top)) 16px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.wordmark { font-size: 15px; line-height: 22px; font-weight: 800; color: var(--text); }
/* The way back to the welcome sheet and the install steps: a quiet text button, always there. */
.topbar-install {
  flex: none; min-height: 44px; margin-right: -8px; padding: 0 8px;
  border: 0; border-radius: var(--r); background: transparent; color: var(--text-2);
  font: inherit; font-size: 13px; line-height: 18px; font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px;
  cursor: pointer;
}
.topbar-install:hover { color: var(--text); text-decoration-color: var(--ember); }
/* On home the big wordmark is the brand; the bar floats over the photo and only carries Install. */
.is-home .topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 4; }
.is-home .wordmark { visibility: hidden; }
.is-home .topbar-install { color: var(--text); }

/* --------------------------------------------------------------------- hero */

/* The first screen is a column exactly one viewport tall: a strip of photo, two lines of copy,
   the controls, and the body map taking every pixel that is left. The map is the point; the photo
   is decoration, so it is the part that gives way. */
.home-first {
  display: flex; flex-direction: column;
  height: 100vh; height: 100svh;
  min-height: 560px; max-height: 1180px;
}
.home-first.is-list { height: auto; min-height: 0; max-height: none; }
.home-first > * { flex: none; }

.hero { margin: 0 -16px; }

.hero-photo {
  position: relative;
  height: clamp(80px, 14vh, 150px);
  height: clamp(80px, 14svh, 150px);
  background: var(--page) url('img/hero.jpg') 62% 30% / cover no-repeat;
  overflow: hidden;
}
/* film grain, generated, not downloaded */
.hero-photo::before {
  content: '';
  position: absolute; inset: 0; z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.08;
  mix-blend-mode: overlay;
  pointer-events: none;
}
/* one scrim from the bottom, one from the left behind the type */
.hero-photo::after {
  content: '';
  position: absolute; inset: 0; z-index: 2;
  background:
    linear-gradient(180deg, transparent 35%, #0d0b0bcc 70%, var(--page) 100%),
    linear-gradient(90deg, #0d0b0bb3 0%, transparent 55%);
}

.hero-mark {
  position: absolute; z-index: 3; left: 20px; bottom: 6px;
  font-size: 36px; line-height: 40px; font-weight: 900; letter-spacing: -0.04em;
}
/* with goals on the first screen the photo shrinks again, so the figure keeps its height */
.has-goals .hero-photo { height: clamp(64px, 9vh, 100px); height: clamp(64px, 9svh, 100px); }
.has-goals .hero-mark { font-size: 30px; line-height: 34px; }
.mark-1 { color: var(--text); }
.mark-2 { color: var(--ember); }

.hero-copy { padding: 4px 20px 0; }
.lede { color: var(--text-2); max-width: 42ch; text-wrap: balance; }
.hero-stat { margin-top: 2px; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text-2); }
.hero-stat strong { color: var(--text); font-weight: 500; }

/* -------------------------------------------------------------------- stage */

.stage {
  position: relative;
  flex: 1 1 0; min-height: 0;
  margin: 4px -16px 0;
  padding: 4px 0 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  overflow: hidden;
  isolation: isolate;
  /* a hold is a hold: no text selection, no callout menu, no double-tap zoom */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  /* a neutral stage: a soft pool of light behind the body on a faint vertical panel, no colour.
     The floor shadow under the feet is drawn in the figure. */
  background:
    radial-gradient(52% 46% at 50% 44%, #ffffff12, #ffffff06 60%, transparent 100%),
    linear-gradient(180deg, transparent, #ffffff0a 18%, #ffffff07 80%, transparent);
}

.map { display: grid; place-items: center; height: 100%; min-height: 0; }
.stage[hidden], .parts[hidden], .goals[hidden] { display: none; }

.figure {
  display: block;
  height: 100%;
  min-height: 0;
  max-height: 780px;
  width: auto;
  aspect-ratio: 124 / 370;
  max-width: 100%;
  overflow: visible;
  touch-action: manipulation;
}

.anatomy { transition: filter var(--t-med) ease; }
/* the carving: dark enough to read at arm's length, still soft at the edges (masked in the SVG) */
.grooves { fill: none; stroke: #0b0503; stroke-opacity: 0.45; stroke-width: 1; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.grooves.details { stroke-opacity: 0.5; stroke-width: 0.8; }
/* the anatomy itself: creases and landmarks, painted under the hotspots */
.lines { fill: none; stroke: #150c08; stroke-opacity: 0.30; stroke-width: 0.8; stroke-linecap: round; pointer-events: none; }
.lines.hi { stroke: #ffd9c2; stroke-opacity: 0.13; }
.rim { fill: none; stroke: #ffc39a; stroke-opacity: 0.55; stroke-width: 2; pointer-events: none; }
.forms, .skin { pointer-events: none; }

/* The pop comes from dimming the rest: the body stays solid, only darker. */
.figure.is-engaged .anatomy { filter: brightness(0.45) saturate(0.6); }

/* The invisible hit area under each group: its own outline, stroked fat and transparent, clipped
   halfway to its neighbours in body-map.js. Only the stroke takes taps; the drawn group above it
   takes the rest. */
.hit {
  fill: none;
  fill-opacity: 0;
  stroke: transparent;
  stroke-width: 14;
  stroke-linejoin: round;
  pointer-events: stroke;
  cursor: pointer;
}

/* At rest every group carries a faint ember edge, so the whole map reads as tappable. */
.hotspot {
  fill: var(--ember);
  fill-opacity: 0.06;
  stroke: #ffb9a0;
  stroke-opacity: 0.14;
  stroke-width: 0.6;
  stroke-linejoin: round;
  cursor: pointer;
  outline: none;
  transition: stroke-opacity var(--t-fast) ease, fill-opacity var(--t-fast) ease;
}
/* hover / touch preview: a strong ember tint and a warm edge, no blur, no scale */
.hotspot.is-hover,
.hotspot:hover {
  fill: #ff7a3d;
  fill-opacity: 0.42;
  stroke: #ffc6a8;
  stroke-opacity: 0.55;
  stroke-width: 0.7;
}
/* selected: solid ember with a highlight and one tight bloom under it */
.hotspot.is-lit {
  fill: url(#ga-lit);
  fill-opacity: 1;
  stroke: #ffd2b8;
  stroke-opacity: 1;
  stroke-width: 0.8;
  filter: url(#ga-bloom);
  transform: none;
}
/* while one group is lit, the others' edges step back with the body */
.figure.is-engaged .hotspot:not(.is-lit) { fill-opacity: 0; stroke-opacity: 0.08; }
.hotspot:focus-visible { stroke: var(--focus); stroke-opacity: 1; stroke-width: 1.6; }

.leader { stroke: var(--ember); stroke-width: 1px; vector-effect: non-scaling-stroke; pointer-events: none; }

.map-label {
  position: absolute; left: 0; top: 0; z-index: 5;
  display: grid;
  transform: translate(var(--x, 0), var(--y, 0));
  opacity: 0;
  pointer-events: none;
}
.map-label[data-side='left'] { text-align: right; }
.map-label.is-on { opacity: 1; }
.map-label-name { font-size: 19px; line-height: 24px; font-weight: 700; color: #fff; }
.map-label-n { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text-2); }

/* ------------------------------------------------- front/back segmented control */

/* Front/Back on the left, Body map/List on the right: two segmented controls on one row. */
.map-bar {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 8px;
  margin: 10px 0 0;
}
/* In the list there is no front or back to pick: the tabs step out, but keep their place. */
.is-list .map-bar > .map-tabs:first-child { visibility: hidden; }
.map-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  min-width: 0; padding: 3px;
  background: var(--raised); box-shadow: inset 0 1px 0 var(--hairline);
  border-radius: var(--r);
}
.home-switch { grid-template-columns: 1.45fr 1fr; }
.tab {
  min-width: 0; min-height: 44px; padding: 0 4px; border: 0; border-radius: var(--r-full);
  white-space: nowrap;
  background: transparent; color: var(--text-2);
  font: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: color var(--t-fast) ease, background-color var(--t-fast) ease;
}
.tab:hover { color: var(--text); }
.tab.is-on { background: #2e2523; color: #fff; box-shadow: inset 0 1px 0 #ffffff1a, inset 0 0 0 1px #ff5a1f2e; }
.tab.is-on:hover { color: #fff; }

.map-hint { text-align: center; color: var(--text-2); font-size: 13px; line-height: 18px; font-weight: 500; margin: 6px 0 0; }

/* ------------------------------------------------------------- my goals */

.goals { margin: 8px 0 0; }
.goals-h {
  margin: 0 0 4px;
  font-size: 13px; line-height: 16px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-2);
}
/* two even columns: four goals are two rows, never a ragged wrap */
.goal-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; padding: 0; list-style: none; }
.goal-chips li { min-width: 0; }
.goal-chip, .goal-all {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 44px; padding: 0 14px;
  border: 0; border-radius: var(--r-full);
  background: var(--raised); box-shadow: inset 0 0 0 1px #ff5a1f40;
  color: var(--text); font: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.goal-name { min-width: 0; overflow-wrap: anywhere; text-align: left; }
.goal-n { color: var(--text-2); font-size: 13px; font-weight: 500; }
.goal-all { justify-content: center; background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2); }
.goal-chip:hover, .goal-all:hover { color: #fff; }

/* -------------------------------------------- the quick list (no body map) */

.parts { margin-top: 12px; }
.parts-h {
  margin: 12px 0 0; padding: 8px 0;
  font-size: 13px; line-height: 18px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-2);
}
.part-list { list-style: none; margin: 0 -16px; padding: 0; border-top: 1px solid var(--line); }
.part-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.part {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; padding: 0 4px 0 16px;
  border: 0; background: transparent; color: var(--text);
  font: inherit; text-align: left;
  cursor: pointer;
}
.part-name { min-width: 0; font-size: 19px; line-height: 24px; font-weight: 650; overflow-wrap: anywhere; }
.part-n { flex: none; color: var(--text-2); font-size: 15px; font-weight: 500; }
.part:hover .part-name, .part:focus-visible .part-name { color: #fff; text-decoration: underline; text-decoration-color: var(--ember); text-underline-offset: 4px; }
.part-row .more { align-self: center; margin-right: 6px; }

/* the ⋯ button: the way to the same sheet a press-and-hold opens */
.more {
  flex: none; display: grid; place-items: center;
  width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0;
  border: 0; border-radius: var(--r-full); background: transparent; color: var(--text-2);
  font: inherit; font-size: 22px; line-height: 1; font-weight: 700;
  cursor: pointer;
}
.more:hover { color: #fff; background: var(--thumb); }

/* ------------------------------------------------- the list of every body part */

.home-first + .overline { margin-top: 28px; }
.overline + .chips { margin-top: 8px; }
.chips {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px;
}
.chip-row { display: flex; align-items: center; min-width: 0; border-bottom: 1px solid var(--line); }
.chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 0;
  border: 0;
  background: transparent; color: var(--text);
  font: inherit; text-align: left;
  cursor: pointer;
  transition: color var(--t-fast) ease;
}
.chip-name { min-width: 0; overflow-wrap: anywhere; }
.chip-n { color: var(--text-2); font-size: 13px; font-weight: 500; }
.chip:hover .chip-name, .chip.is-active .chip-name { color: #fff; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }

.disclaimer { color: var(--faint); font-size: 13px; line-height: 18px; margin-top: 32px; }

/* ------------------------------------------------------------ muscle screen */

.back {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 4px 0 0 -8px; min-height: 44px; padding: 0 8px;
  border: 0; border-radius: var(--r); background: transparent; color: var(--text-2);
  font: inherit; font-size: 15px; font-weight: 500;
  cursor: pointer;
}
.back svg { width: 16px; height: 16px; }
.back:hover { color: var(--text); }

.muscle-head {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px 16px; align-items: center;
  margin: 0 -16px; padding: 12px 8px 12px 16px;
  background: var(--overlay);
  border-bottom: 1px solid var(--line);
}
.mini-wrap { width: 52px; height: 96px; display: grid; place-items: center; }
.figure.mini { height: 96px; min-height: 0; pointer-events: none; }
.mini .hotspot:not(.is-lit) { stroke-opacity: 0; fill-opacity: 0; }
.mini .rim { stroke-width: 4; }

.muscle-title { min-width: 0; }
.muscle-title .overline { overflow-wrap: anywhere; }
.muscle-head h1 {
  margin-top: 2px;
  font-size: 32px; line-height: 36px; font-weight: 800; letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.goal-pill {
  display: inline-block; margin-top: 6px; padding: 2px 10px;
  border-radius: var(--r-full); box-shadow: inset 0 0 0 1px #ff5a1f59;
  color: var(--text); font-size: 13px; line-height: 18px; font-weight: 600;
}
.goal-pill[hidden] { display: none; }

.muscle-blurb { margin-top: 24px; color: var(--text-2); }
.muscle-blurb b { color: var(--text); font-weight: 600; }
.joint-note { display: block; margin-top: 4px; font-size: 13px; line-height: 18px; font-weight: 500; }
.muscle-joint { margin-top: 10px; color: var(--text-2); }

/* "You picked: Chest · Beginner · 4 movements": the top of a workout sheet, and the way to change level */
.picked {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 56px; margin: 12px 0 0; padding: 8px 14px;
  border: 0; border-radius: var(--r);
  background: var(--raised); box-shadow: inset 0 0 0 1px #ff5a1f40;
  color: var(--text-2); font: inherit; text-align: left;
  cursor: pointer;
}
.picked-text { display: grid; min-width: 0; }
.picked-over { font-size: 13px; line-height: 18px; font-weight: 500; }
.picked-what { color: var(--text-2); font-size: 15px; line-height: 21px; }
.picked b { color: #fff; font-weight: 650; }
.picked-change {
  flex: none; color: var(--ember); font-size: 13px; line-height: 18px; font-weight: 700;
}
.picked[aria-expanded='true'] .picked-change { color: var(--text-2); }
.picked:hover { background: var(--thumb); }
.level-pick { margin-top: 8px; }
.level-pick[hidden] { display: none; }

/* the three level choices: one row of big buttons, the count under each name */
/* All is a short word and Intermediate + a long one: roughly thirds, weighted so neither wraps at 360. */
.levels { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1.3fr); gap: 6px; }
.level-choice {
  display: grid; align-content: center; justify-items: center; gap: 0;
  min-width: 0; min-height: 56px; padding: 6px 4px;
  border: 0; border-radius: var(--r);
  background: var(--thumb); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text); font: inherit; text-align: center;
  cursor: pointer;
}
.level-name { font-size: 14px; line-height: 20px; font-weight: 700; white-space: nowrap; }
.level-n { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text-2); }
.level-choice:hover { background: #2e2523; }
.level-choice.is-on { background: #3a1e12; box-shadow: inset 0 0 0 2px var(--ember); }
.level-choice.is-on .level-n { color: var(--text); }
.level-choice:disabled { cursor: default; opacity: 0.45; }
.pick-note { margin-top: 6px; padding: 0 4px; color: var(--faint); font-size: 13px; line-height: 18px; }

/* filters: one segmented control of real <select>s (where, kit) */
.filters {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px;
  margin: 16px 0 8px; padding: 3px;
  background: var(--raised); box-shadow: inset 0 1px 0 var(--hairline);
  border-radius: var(--r);
}
.filter { position: relative; display: block; min-width: 0; border-radius: 11px; }
.filter + .filter::before {
  content: ''; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 1px; background: var(--line);
}
.filter > span {
  position: absolute; left: 10px; top: 7px;
  font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text-2);
  pointer-events: none;
}
.filter select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  display: block; width: 100%; min-height: 54px; margin: 0;
  padding: 25px 22px 7px 10px;
  border: 0; border-radius: 11px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23a49c98' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 6px center / 13px no-repeat;
  color: var(--text);
  font: inherit; font-size: 15px; line-height: 22px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.filter select:focus-visible { outline: none; }
.filter option { background: var(--raised); color: var(--text); }
.filter:hover { background: var(--thumb); }
.filter:focus-within { outline: 2px solid var(--focus); outline-offset: 0; }
/* the one active state on this screen: a filter that is set */
.filter.is-set select { color: var(--ember); font-weight: 600; }

/* exercise rows: full bleed, divided, never boxed */
.exercises { list-style: none; padding: 0; margin: 0 -16px; border-top: 1px solid var(--line); }
.exercise { border-bottom: 1px solid var(--line); }
.exercise:has(details[open]) { background: var(--raised); box-shadow: inset 0 1px 0 var(--hairline); }

.exercise summary { list-style: none; cursor: pointer; padding: 16px; display: grid; gap: 4px; }
.exercise summary::-webkit-details-marker { display: none; }
.exercise summary:focus-visible { outline-offset: -2px; }

.ex-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ex-name { font-size: 17px; line-height: 22px; font-weight: 650; color: #fff; }
.ex-toggle { flex: none; width: 16px; height: 22px; display: grid; place-items: center; color: var(--text-2); }
.ex-toggle svg { width: 16px; height: 16px; transition: transform var(--t-med) var(--ease-out); }
details[open] .ex-toggle svg { transform: rotate(180deg); }

.ex-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text-2);
}
.level { display: inline-flex; gap: 2px; align-items: flex-end; }
.level i { display: block; width: 4px; height: 10px; border-radius: 1px; background: var(--bar-off); }
.level i.on { background: var(--text); }

.ex-dose { margin-top: 4px; color: var(--text-2); font-size: 13px; line-height: 22px; font-weight: 500; }
.ex-dose b { color: #fff; font-size: 17px; font-weight: 650; }
.ex-dose .x { font-size: 17px; font-weight: 650; }

.ex-body { padding: 0 16px 20px; display: grid; gap: 12px; color: var(--text); }
.ex-body strong {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; line-height: 18px; font-weight: 600; color: var(--text-2);
}

/* the how-to: a diagram and the one cue that matters, side by side above the steps */
.ex-quarter { display: flex; align-items: center; gap: 14px; }
.ex-diagram {
  flex: none; width: 108px; aspect-ratio: 1; margin: 0;
  border-radius: 12px; background: radial-gradient(120% 120% at 30% 20%, #1d1917, #0f0d0c);
  box-shadow: inset 0 0 0 1px var(--hairline);
  display: grid; place-items: center; overflow: hidden;
}
.ex-diagram .diagram-svg { width: 100%; height: 100%; display: block; }
.ex-diagram .limb { fill: none; stroke: #e8e2dc; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.ex-diagram .limb.far { stroke: #8f8984; }
.ex-diagram .head { fill: none; stroke: #e8e2dc; stroke-width: 6; }
.ex-diagram .ghost { opacity: 0.3; }
.ex-diagram .joint { fill: var(--ember); stroke: #0f0d0c; stroke-width: 1.5; }
.ex-diagram .eq { fill: none; stroke: var(--ember); stroke-width: 3.5; stroke-linecap: round; }
.ex-diagram .eq-block { fill: var(--ember); }
.ex-diagram .eq-fill { fill: var(--ember); fill-opacity: 0.32; stroke: var(--ember); stroke-width: 2; stroke-linejoin: round; }
.ex-diagram .eq-line { fill: none; stroke: var(--ember); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ex-diagram .rail { stroke: var(--ember); stroke-width: 3; stroke-linecap: round; opacity: 0.55; }
.ex-diagram .floor { stroke: var(--ember); stroke-width: 2.5; stroke-linecap: round; opacity: 0.5; }
.ex-diagram .arrow { fill: none; stroke: var(--ember); stroke-width: 3; stroke-linecap: round; }
.ex-diagram .arrow-head { fill: var(--ember); }
/* a drawing with two poses is a button: tap it and the figure does one rep */
.ex-fig { flex: none; width: 108px; display: grid; gap: 6px; justify-items: center; }
button.ex-diagram {
  padding: 0; border: 0; color: inherit; font: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
button.ex-diagram:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.ex-hint { margin: 0; font-size: 13px; line-height: 17px; color: var(--text-2); text-align: center; }
.ex-cue { margin: 0; font-size: 14px; line-height: 20px; color: var(--text); }
.ex-cue strong { margin-bottom: 2px; }

.ex-steps-title { margin: 2px 0 -4px; }
.ex-steps { margin: 0; padding: 0; list-style: none; counter-reset: ex-step; display: grid; gap: 8px; }
.ex-steps li {
  counter-increment: ex-step; position: relative;
  padding-left: 30px; font-size: 15px; line-height: 21px; color: var(--text);
}
.ex-steps li::before {
  content: counter(ex-step); position: absolute; left: 0; top: 0;
  width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #0d0b0b; background: var(--text-2);
}

.ex-avoid { border-left: 2px solid var(--ember); padding-left: 12px; }
.ex-avoid strong { color: var(--text); }
.ex-avoid svg { width: 14px; height: 14px; color: var(--ember); }
.ex-secondary { color: var(--text-2); font-size: 13px; line-height: 18px; font-weight: 500; }

.empty { color: var(--text-2); padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.other { margin-top: 40px; }
.other .chips { margin-top: 4px; }

/* ------------------------------------------------------------- site footer */

.site-foot {
  max-width: 620px; margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  color: var(--faint); font-size: 13px; line-height: 18px;
}
.site-foot a { color: var(--text-2); text-underline-offset: 3px; text-decoration-color: var(--line); }
.site-foot a:hover { color: var(--text); text-decoration-color: var(--ember); }

/* ----------------------------------------------------------- welcome sheet */

.welcome-open, .welcome-open body { overflow: hidden; }

/* A bottom sheet on a phone, a centred panel on anything wider. No padding on the
   <dialog> itself, so a tap that lands on it is a tap outside the content. */
.sheet {
  width: 100%; max-width: 520px; max-height: min(88vh, 720px); max-height: min(88svh, 720px);
  margin: auto auto 0; padding: 0;
  border: 0; border-radius: var(--r) var(--r) 0 0;
  background: var(--raised); color: var(--text);
  box-shadow: inset 0 1px 0 var(--hairline);
  overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; }
.sheet::backdrop { background: #0d0b0bd9; }

.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 24px 20px 8px; }
.sheet-title { margin-top: 2px; font-size: 32px; line-height: 36px; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.sheet-lede { margin-top: 12px; font-size: 17px; line-height: 24px; color: var(--text); }
.sheet-note { margin-top: 8px; color: var(--text-2); }

.sheet-h {
  margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 13px; line-height: 16px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-2);
}
.sheet-steps { margin: 12px 0 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.sheet-steps li { position: relative; padding-left: 32px; counter-increment: step; }
.sheet-steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: var(--r-full); background: var(--ember); color: var(--ember-ink);
  font-size: 13px; font-weight: 700;
}
.sheet-count { margin-top: 16px; color: var(--text-2); }
.sheet-count b { color: var(--text); font-weight: 650; }

.sheet-install p { margin-top: 12px; color: var(--text-2); }
.sheet-install .install-done { color: var(--text); }
.install-how { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.install-how li { padding-left: 12px; border-left: 2px solid var(--line); color: var(--text-2); }
.install-how li:first-child { border-left-color: var(--ember); }
.install-how b { color: var(--text); font-weight: 600; }
.install-how[hidden], .install-done[hidden], .btn[hidden] { display: none; }

.sheet-foot { flex: none; padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.btn {
  display: block; width: 100%; min-height: 48px; padding: 0 16px;
  border: 0; border-radius: var(--r);
  font: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer;
}
.btn-ember { background: var(--ember); color: var(--ember-ink); }
.btn-ember:hover { background: #ff6d39; }
.btn-quiet { margin-top: 12px; background: var(--thumb); color: var(--text); box-shadow: inset 0 0 0 1px #ff5a1f2e; }
.btn-quiet:hover { background: #2e2523; }

/* ------------------------------------------------------------- peek sheet */

/* Opened by press-and-hold on the map, or by any ⋯ button. Three thumb-sized actions, the
   primary one first. Swipe down, tap outside or Esc closes it. */
.peek {
  width: 100%; max-width: 520px;
  margin: auto auto 0; padding: 0;
  border: 0; border-radius: var(--r) var(--r) 0 0;
  background: var(--raised); color: var(--text);
  box-shadow: inset 0 1px 0 var(--hairline);
  touch-action: none;
}
.peek::backdrop { background: #0d0b0bd9; }
.peek-body { padding: 10px 20px calc(16px + env(safe-area-inset-bottom)); }
.peek-grab { display: block; width: 40px; height: 4px; margin: 0 auto 14px; border-radius: 2px; background: var(--line); }
.peek-title { font-size: 28px; line-height: 32px; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.peek-n { margin-top: 2px; color: var(--text-2); }
.peek-status { min-height: 22px; margin-top: 6px; color: var(--ember); font-weight: 600; }
.peek-actions { display: grid; gap: 10px; margin-top: 8px; }
.peek .btn { min-height: 56px; margin: 0; font-size: 17px; }

/* ------------------------------------------------------- the pick panel */

/* Tap 1 on the map opens this: non-modal, docked to the bottom above the safe area, so Start sits
   under the thumb and the map behind it stays live. The page scrolls the picked group above it. */
.pick {
  position: fixed; inset: auto 0 0; z-index: 20;
  width: 100%; max-width: 520px; margin: 0 auto; padding: 0;
  border: 0; border-radius: var(--r) var(--r) 0 0;
  background: var(--raised); color: var(--text);
  box-shadow: inset 0 1px 0 var(--hairline), 0 -12px 32px #000000a6;
}
.pick-body { position: relative; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
.pick-latin { padding: 4px 48px 0 4px; overflow-wrap: anywhere; }
.pick-name {
  margin-top: 2px; padding: 0 48px 0 4px;
  font-size: 26px; line-height: 30px; font-weight: 800; letter-spacing: -0.02em; color: #fff;
  overflow-wrap: anywhere;
}
.pick-blurb { margin-top: 2px; padding: 0 4px; color: var(--text-2); font-size: 14px; line-height: 19px; }
.pick-blurb .joint-note { margin-top: 2px; }
.pick-n { margin-top: 4px; padding: 0 4px; color: var(--text); font-size: 13px; line-height: 18px; font-weight: 600; }
.pick .levels { margin-top: 8px; }
.pick-actions { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; margin-top: 10px; }
.pick .pick-start { min-height: 52px; padding: 0 8px; font-size: 16px; white-space: nowrap; }
@media (max-width: 374px) { .pick .pick-start { font-size: 15px; } }

/* Short phones: the panel gives a little back, so the whole body still fits above it. */
@media (max-height: 860px) {
  .pick-latin { display: none; }
  .pick-body { padding-top: 6px; }
  .pick-note { font-size: 13px; line-height: 17px; }
}
@media (max-height: 800px) {
  .pick-body { padding-top: 8px; }
  .pick-note { display: block; }
  .pick-name { font-size: 23px; line-height: 27px; }
  .pick-blurb { font-size: 13px; line-height: 18px; }
  .pick-note { display: none; }
  .pick .levels { margin-top: 6px; }
  .level-choice { min-height: 52px; }
  .pick-actions { margin-top: 8px; }
  .pick .pick-start, .pick-save { min-height: 50px; }
}
.pick-save {
  min-height: 52px; padding: 0 8px;
  border: 0; border-radius: var(--r);
  background: transparent; box-shadow: none; text-decoration: underline; text-underline-offset: 3px;
  color: var(--text-2); font: inherit; font-size: 13px; line-height: 16px; font-weight: 600;
  cursor: pointer;
}
.pick-save[aria-pressed='true'] { color: var(--ember); text-decoration: none; }
.pick-save:hover { color: var(--text); }
.pick-close {
  position: absolute; top: 4px; right: 4px;
  display: grid; place-items: center;
  width: 48px; min-width: 48px; height: 48px; min-height: 48px; padding: 0;
  border: 0; border-radius: var(--r-full); background: transparent; color: var(--text-2);
  font: inherit; font-size: 28px; line-height: 1;
  cursor: pointer;
}
.pick-close:hover { color: #fff; background: var(--thumb); }
/* room under the page's last line, so nothing is stuck behind the open panel */
.pick-open body { padding-bottom: calc(var(--pick-h, 300px) + env(safe-area-inset-bottom)); }

/* While a group is picked, the panel owns the bottom of the screen, so give the body the room
   above it: the photo and the copy step away and the figure shrinks to fit, so every group stays
   tappable instead of sitting behind the sheet. */
.pick-open .hero { display: none; }
.pick-open .stage { margin-top: 0; }
.pick-open .figure {
  height: calc(100svh - var(--pick-h, 300px) - 176px);
  min-height: 260px;
  max-height: 56svh;
}
@media (max-height: 700px) {
  .pick-open .figure { height: calc(100svh - var(--pick-h, 300px) - 160px); min-height: 220px; }
}

/* ------------------------------------------------------------------- motion */

@media (prefers-reduced-motion: no-preference) {
  .figure.is-intro .hotspot { animation: ga-intro 900ms ease-in-out both; animation-delay: var(--d, 0ms); }
  .map-label.is-on { animation: ga-fade var(--t-fast) ease-out both; }
  .exercise { animation: ga-rise 360ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 30ms); }
  .no-stagger .exercise { animation: none; }
  details[open] .ex-body { animation: ga-fade 200ms ease-out both; }
  .sheet[open] { animation: ga-sheet 280ms var(--ease-out) both; }
  .sheet[open]::backdrop { animation: ga-fade 200ms ease-out both; }
  .peek[open] { animation: ga-sheet 200ms var(--ease-out) both; }
  .peek[open]::backdrop { animation: ga-fade 160ms ease-out both; }
  .pick[open] { animation: ga-sheet 160ms var(--ease-out) both; }
  /* a rep: the arrow steps aside while the figure moves, the faint start pose and arrow return after */
  .ex-diagram .anim-arrows { animation: ga-out 160ms ease-out both; }
  .ex-diagram.is-settling .ghost, .ex-diagram.is-settling .arrow, .ex-diagram.is-settling .arrow-head { animation: ga-in 240ms ease-out both; }
}

@keyframes ga-out { to { opacity: 0; } }
@keyframes ga-in { from { opacity: 0; } }

@keyframes ga-sheet {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

@keyframes ga-intro {
  0%, 100% { stroke-opacity: 0.28; fill-opacity: 0.03; }
  50% { stroke-opacity: 1; fill-opacity: 0.3; }
}
@keyframes ga-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes ga-fade { from { opacity: 0; } to { opacity: 1; } }

/* Reduced motion: no animation and no transitions anywhere, state changes are instant. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------------- larger */

@media (min-width: 620px) {
  .hero, .stage { margin-left: 0; margin-right: 0; }
  .hero-photo { border-radius: 0 0 var(--r) var(--r); }
  .muscle-head { margin: 0; }
  .exercises { margin: 0; }
  .sheet, .peek { margin: auto; border-radius: var(--r); }
}
