/* OnTrack — the brand from the deck: white, grape ink, cream panels, cards in
   tangerine, lime and pink with a hard grape shadow, Righteous for display and
   Nunito for everything else. The Review page keeps its dark workbench. */
:root {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #fff3e2; --cream: #fff3e2; --line: #e9d6bf;
  --ink: #2b1546; --muted: #6b5a82; --grape: #2b1546;
  --pink: #ff2e88; --tangerine: #ffb830; --lime: #b8f542;
  --good: #2e9e5b; --warn: #d98a00; --bad: #e0245e; --accent: #2b1546;
  --r: 16px; --shadow: 6px 6px 0 var(--grape);
  --font-display: 'Righteous', 'Nunito', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Nunito', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --stage-h: 62vh;      /* how much of the screen the picture may take, so the set button stays on it */
  /* the muscle figure's palette (anatomy.js reads these) */
  --fig-skin: #f6e3c8; --fig-line: #c9a878; --fig-muscle: #e7cda9; --fig-far: #efe0c8; --fig-farline: #dcc6a4;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font-body);
  padding: 0 16px calc(32px + env(safe-area-inset-bottom));
  -webkit-text-size-adjust: 100%;
}
main { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; }
h1, h2, h3 { margin: 0; }
h2 { font: 700 1rem/1.3 var(--font-body); margin-bottom: 8px; }
h2.gap { margin-top: 14px; }
.lede { margin: 6px 0 0; color: var(--muted); font-weight: 700; }
.center { text-align: center; }

/* ---- the bar: three stripes, the mark, a search, the info button ---- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--bg);
  display: flex; align-items: center; gap: 10px; padding: 18px 0 10px; margin: 0 -16px 0; padding-inline: 16px;
  border-bottom: 2px solid var(--line);
}
.topbar::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 9px;
  background: linear-gradient(to bottom, var(--tangerine) 0 3px, var(--lime) 3px 6px, var(--pink) 6px 9px); }
.brand { text-decoration: none; color: inherit; flex: 0 0 auto; }
.wordmark { font: 400 1.45rem/1 var(--font-display); letter-spacing: -.01em; color: var(--grape); }
.nav-title { font: 400 1.1rem/1.2 var(--font-display); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search {
  flex: 1 1 120px; min-width: 0; min-height: 40px; padding: 8px 12px; border-radius: 999px;
  border: 2px solid var(--grape); background: var(--surface); color: var(--ink); font: 700 .92rem var(--font-body);
}
.search::placeholder { color: var(--muted); font-weight: 600; }
.iconbtn {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 999px; border: 2px solid var(--grape); background: var(--surface);
  color: var(--grape); font: 900 1rem var(--font-body); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none;
}
.iconbtn.back { font-size: 1.6rem; line-height: 1; padding-bottom: 3px; }
.i-mark { font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-weight: 900; }
body:not(.at-home) .search { display: none; }
body.at-home .nav-title, body.at-home .back, body.at-ex .nav-title { display: none; }
body.at-live .topbar { display: none; }

.chip {
  margin-left: auto; font-size: .72rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; background: var(--cream); border: 2px solid var(--line); color: var(--muted);
}
.chip.good { background: rgba(184,245,66,.45); border-color: var(--lime); color: var(--grape); }
.chip.warn { background: rgba(255,184,48,.35); border-color: var(--tangerine); color: var(--grape); }
.chip.bad  { background: rgba(255,46,136,.2); border-color: var(--pink); color: var(--grape); }

/* ---- how it works ---- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(43,21,70,.6); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-in { position: relative; background: var(--surface); border: 2px solid var(--grape); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; max-width: 460px; width: 100%; max-height: 92vh; overflow: auto; }
.modal-in h2 { font: 400 1.5rem/1.2 var(--font-display); margin-bottom: 12px; }
.modal .close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; }
.how-steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 12px; counter-reset: step; }
.how-steps li { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; }
.how-steps svg { grid-row: 1 / span 2; width: 44px; height: 44px; padding: 8px; border-radius: 999px; background: var(--cream); color: var(--grape); }
.how-steps b { font-weight: 900; }
.how-steps span { color: var(--muted); font-size: .9rem; }
.how-steps li:nth-child(3n+1) svg { background: var(--tangerine); }
.how-steps li:nth-child(3n+2) svg { background: var(--lime); }
.how-steps li:nth-child(3n+3) svg { background: var(--pink); color: #fff; }

/* ---- the exercises, as a list: the name, what it works, a coloured mark ---- */
.list { display: block; margin: 8px 0 0; border-top: 2px solid var(--grape); }
.item {
  display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px; padding: 12px 4px 12px 2px;
  border-bottom: 2px solid var(--line); color: var(--grape); text-decoration: none; cursor: pointer;
}
.item:active { background: var(--cream); }
.item[hidden] { display: none; }
.item .fig { width: 64px; height: 44px; display: flex; align-items: center; justify-content: center; background: var(--cream); border-radius: 10px; overflow: hidden; }
.item .fig svg { width: 60px; height: 40px; max-width: none; margin: 0; overflow: visible; }
.item .fig .lbl { display: none; }
/* the plain stick figure (Figure.svg): the home tiles and an exercise's second angle */
.stick .ink { fill: none; stroke: var(--grape); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.stick circle.ink { fill: var(--grape); stroke: none; }
.stick .far { opacity: .35; }
.stick .floor { fill: none; stroke: var(--line); stroke-width: 4; }
.stick.view-iso .floor { fill: var(--cream); stroke: var(--line); stroke-width: 2; }
.stick .cam { fill: var(--grape); }
.stick .lbl { font: 700 11px var(--font-body); fill: var(--muted); }
/* equipment in the stick figure (props.js): a light fill and the figure's warm line; metal dark, fabric soft, a band pink */
:root { --prop-fill: #fbe2c0; --prop-line: #c9a878; --prop-dark: #7a6650; --prop-soft: #f3d9b8; }
.stick .prop .part { fill: var(--prop-fill); stroke: var(--prop-line); stroke-width: 1.5; stroke-linejoin: round; }
.stick .prop.tone-soft .main, .stick .prop .part.soft { fill: var(--prop-soft); }
.stick .prop.tone-dark .main, .stick .prop .part.dark { fill: var(--prop-dark); }
.stick .prop.tone-accent .main { fill: var(--pink); }
.stick .prop .part.none { fill: var(--bg); }
.stick .prop .part.line { fill: none; stroke: var(--prop-dark); stroke-width: 1.2; }
.stick .prop.link { fill: none; stroke: var(--prop-dark); stroke-width: 2.5; stroke-linecap: round; }
.stick .prop-band.link { stroke: var(--pink); stroke-width: 2; stroke-dasharray: 5 4; }
.stick .prop-stick.link { stroke-width: 3.5; }
.stick .prop-line.link { stroke: var(--prop-line); stroke-width: 1.5; }
.stick .prop-text { font: 700 8px var(--font-body); fill: var(--prop-dark); }
.fig-second { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r); padding: 6px 10px 2px; }
.fig-second svg { width: 100%; max-width: 460px; height: auto; max-height: 190px; aspect-ratio: auto; display: block; margin: 0 auto; }
.item .txt { min-width: 0; }
.item .name { font: 400 1.2rem/1.15 var(--font-display); display: block; }
.item .name .badge { vertical-align: middle; margin-left: 6px; background: var(--tangerine); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--pink); font: inherit; font-weight: 900; text-decoration: underline; cursor: pointer; }
.item .muscles { margin: 2px 0 0; font-size: .82rem; font-weight: 600; color: var(--muted); display: block; }
.item::after { content: '›'; font: 900 1.5rem/1 var(--font-body); color: var(--grape); padding-right: 4px; }

/* ---- programmes and plans ---- */
.plans-home h2 { margin: 14px 0 4px; }
.plans-home h2.gap { margin-top: 18px; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 8px 0 0; }
.plan { display: grid; gap: 4px; padding: 12px 14px; background: var(--cream); border: 2px solid var(--line); border-radius: var(--r); color: var(--grape); text-decoration: none; }
.plan:active { border-color: var(--grape); }
.plan .name { font: 400 1.15rem/1.15 var(--font-display); }
.plan .for { font-size: .84rem; font-weight: 600; color: var(--muted); }
.plan .n { font-size: .78rem; font-weight: 700; }
.plan.new { background: var(--surface); border-style: dashed; }
.plan-head .muted { margin: 2px 0 0; font-weight: 700; }
.plan-items { list-style: none; margin: 12px 0 0; padding: 0; border-top: 2px solid var(--grape); }
.plan-item { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 2px solid var(--line); }
.plan-item .fig { width: 64px; height: 44px; display: flex; align-items: center; justify-content: center; background: var(--cream); border-radius: 10px; overflow: hidden; }
.plan-item .fig svg { width: 60px; height: 40px; max-width: none; margin: 0; overflow: visible; }
.plan-item .fig .lbl { display: none; }
.plan-item .txt { min-width: 0; display: grid; gap: 2px; }
.plan-item .name { font: 400 1.15rem/1.15 var(--font-display); }
.plan-item .what { font-size: .84rem; font-weight: 700; color: var(--muted); }
.plan-item .step-note { font-size: .84rem; font-weight: 700; padding: 6px 10px; background: var(--cream); border: 2px solid var(--tangerine); border-radius: 8px; }
.plan-item .step-note:empty { display: none; }
.plan-item .rowtools { grid-column: 1 / -1; justify-content: flex-end; }
.plan-item .adj { grid-column: 1 / -1; display: grid; gap: 8px; padding: 10px; background: var(--cream); border-radius: 10px; }
.plan-item.missing .name { color: var(--bad); }
.plan-item.empty { grid-template-columns: 1fr; }
.btn.small { padding: 8px 12px; font-size: .9rem; }
.add-ex select { flex: 1 1 200px; }
.plan-banner { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin: 0 0 6px; padding: 8px 12px; background: var(--cream); border-radius: 10px; font-size: .86rem; font-weight: 700; }
.plan-banner .step { color: var(--muted); }
.plan-banner .what { flex: 1 1 100%; font-weight: 600; }
.plan-banner a { color: var(--pink); font-weight: 900; text-decoration: none; }
.plan-banner .next { margin-left: auto; }
.rom { display: grid; gap: 4px; margin: 8px 0; }
.rom input[type=range] { width: 100%; max-width: 420px; }
.adj-faults { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 8px; }
.adj-faults label.check { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 700; }
.adj-faults .tiny { flex-basis: 100%; }
.ticks li.off { color: var(--muted); text-decoration: line-through; }
.ticks li.off i { text-decoration: none; font-style: normal; font-weight: 700; }
.sources { margin: 8px 0 0; padding-left: 18px; font-size: .82rem; }
.sources a { color: var(--pink); }
.linkbtn.file input { display: none; }

/* ---- the exercise page: title, the figure, the bubbles, start — one screen ---- */
.ex-top { min-height: calc(100svh - 84px); display: grid; grid-template-rows: auto 1fr auto auto auto; gap: 10px; align-content: start; }
.ex-title { font: 400 1.7rem/1.1 var(--font-display); }
.fig-wrap { background: var(--cream); border: 2px solid var(--grape); border-radius: var(--r); box-shadow: var(--shadow); min-height: 200px; max-height: min(52svh, 440px); overflow: hidden; align-self: stretch; }
.fig-wrap canvas { width: 100%; height: 100%; max-width: none; aspect-ratio: auto; display: block; margin: 0; }
.bubbles { display: flex; flex-wrap: wrap; gap: 8px; }
.bubble {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 8px 14px; border-radius: 999px;
  border: 2px solid var(--grape); background: var(--surface); color: var(--grape); font: 900 .95rem/1.1 var(--font-body); cursor: pointer;
}
.bubble .k { font-weight: 700; color: var(--muted); }
.bubble:active { transform: translateY(1px); }
.bubble.na { display: none; }
.custom-load { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--grape); }
.custom-load input { width: 6.5em; min-height: 40px; padding: 6px 10px; border-radius: 12px; border: 2px solid var(--grape); font: 800 1rem var(--font-body); color: var(--ink); background: var(--surface); }
.custom-load[hidden] { display: none; }
.btn.go { min-height: 54px; font-size: 1.1rem; }
.ex-more { display: grid; gap: 14px; }
.ticks { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: .92rem; }
.ticks li::marker { color: var(--good); }

/* ---- the stage: the canvas is the app's picture and the recording's picture ---- */
.stage {
  position: relative; border-radius: var(--r); overflow: hidden; background: #000;
  width: 100%; aspect-ratio: 16/9; max-height: var(--stage-h); margin-inline: auto;
}
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; }
body.full { overflow: hidden; }
body.full .stage {
  position: fixed; inset: 0; z-index: 50; border-radius: 0;
  width: auto !important; max-width: none !important; max-height: none; aspect-ratio: auto !important;
}
.float { position: absolute; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom)); display: none; justify-content: center; gap: 8px; pointer-events: none; }
body.full .float { display: flex; }
.float .btn { pointer-events: auto; flex: 0 0 auto; min-width: 150px; opacity: .94; box-shadow: 0 6px 24px rgba(0,0,0,.5); }

.veil {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #fff;
  background: rgba(43,21,70,.88); backdrop-filter: blur(3px); padding: 20px; overflow: auto;
}
.veil[hidden] { display: none; }
.veil-in { display: grid; gap: 10px; justify-items: center; max-width: 34ch; }
.veil .tiny { color: rgba(255,255,255,.75); }
.big { font: 400 1.3rem/1.2 var(--font-display); margin: 0; }
.muted { color: var(--muted); margin: 0; font-size: .92rem; }
.tiny { color: var(--muted); font-size: .8rem; margin: 6px 0 0; }

.log .set { list-style: none; margin: 8px 0 2px -20px; color: var(--ink); font-weight: 700; }

/* ---- readings ---- */
.reads { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.read { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.read.wide { grid-column: 1 / -1; }
.read .v { font-size: 2rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.read .v i { font-size: .95rem; font-style: normal; font-weight: 700; color: var(--muted); margin-left: 2px; }
.read .k { color: var(--muted); font-size: .8rem; margin-top: 6px; display: flex; gap: 8px; align-items: baseline; }
.read .band { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); opacity: .9; }
.read.good { border-color: var(--good); } .read.good .v { color: var(--good); }
.read.bad  { border-color: var(--bad); } .read.bad  .v { color: var(--bad); }
.meter { position: relative; height: 6px; border-radius: 3px; background: var(--cream); margin-top: 10px; overflow: hidden; }
.meter .ok { position: absolute; top: 0; bottom: 0; background: rgba(46,158,91,.35); }
.meter b { position: absolute; top: -3px; width: 3px; height: 12px; border-radius: 2px; background: var(--grape); transform: translateX(-1px); transition: left .08s linear; }
#read-hold .meter .ok { background: rgba(46,158,91,.18); }
#read-hold .meter b { background: var(--good); width: 4px; }

.note {
  margin: 0; padding: 10px 14px; border-radius: 12px; text-align: center; font-weight: 700;
  background: rgba(255,184,48,.25); border: 2px solid var(--tangerine); color: var(--grape);
}
.note[hidden], body.at-home .note, body.at-done .note { display: none; }
.cue { min-height: 1.6em; margin: 0; font-weight: 900; font-size: 1.05rem; text-align: center; }
.faults { min-height: 1.4em; margin: -8px 0 0; text-align: center; font-size: .82rem; font-weight: 900; color: var(--bad); letter-spacing: .01em; }
.faults:empty { display: none; }
.cue.bad { color: var(--bad); }

/* ---- controls ---- */
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; }
.row.two .btn { min-width: 0; padding-inline: 8px; }
.sheet-rows { display: grid; gap: 8px; margin-bottom: 12px; }
.btn {
  flex: 1 1 auto; min-height: 46px; padding: 0 16px; border-radius: 12px; cursor: pointer;
  background: var(--surface); color: var(--grape); border: 2px solid var(--grape);
  font: 900 1rem var(--font-body); text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover:not(:disabled) { background: var(--cream); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--grape); border-color: var(--grape); color: #fff; }
.btn.stop { background: var(--pink); border-color: var(--pink); color: #fff; }
.btn[aria-pressed="true"] { background: var(--lime); }
a.btn.link { }

.panel { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r); padding: 14px; }
.panel.cream { background: var(--cream); border-color: var(--cream); }
.panel p { margin: 0 0 8px; font-size: .92rem; }
.panel.how p:last-child { margin-bottom: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.grid label { display: grid; gap: 4px; font-size: .8rem; color: var(--muted); font-weight: 700; }
.grid input, .grid select, textarea {
  background: var(--surface); color: var(--ink); border: 2px solid var(--line); border-radius: 10px;
  padding: 9px 10px; font: 700 1rem var(--font-body); min-height: 40px;
}
textarea { width: 100%; resize: vertical; }
.log { margin: 12px 0 0; padding-left: 20px; color: var(--muted); font-size: .88rem; display: grid; gap: 3px; max-height: 240px; overflow: auto; }
.log b { color: var(--ink); font-variant-numeric: tabular-nums; }
.advanced { margin-top: 10px; }
.advanced summary { cursor: pointer; font-weight: 900; color: var(--muted); }
.setup { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--muted); font-size: .92rem; }
.setup li::marker { color: var(--grape); font-weight: 900; }
.setup b { color: var(--ink); }
.how #ex-more-words p { margin-top: 8px; }

/* ---- how it felt ---- */
.feel { display: grid; gap: 10px; }
.feel-row { display: grid; gap: 6px; }
.feel-k { font-size: .8rem; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg .btn { flex: 1 1 auto; min-height: 40px; font-size: .9rem; }

@media (max-width: 420px) { .read .v { font-size: 1.6rem; } .row:not(.two) > .btn { flex-basis: 100%; } .seg .btn { flex-basis: auto; } }

/* ---- the Review page keeps its dark workbench ---- */
body.review {
  --bg: #0d1117; --surface: #161b22; --surface-2: #1d2430; --line: #263040; --ink: #e8edf4; --muted: #8b97a8;
  --good: #35d07f; --warn: #ffb545; --bad: #ff5c6c; --accent: #5aa9ff; --grape: #e8edf4; --cream: #1d2430;
  --fig-skin: #46295f; --fig-line: #7658a0; --fig-muscle: #55367a; --fig-far: #38215a; --fig-farline: #4d3178;
  --prop-fill: #2b3546; --prop-line: #5d6b80; --prop-dark: #9aa6b8; --prop-soft: #354156;
  --shadow: none; color-scheme: dark;
}
body.review main, body.review .bar { max-width: 1240px; }
body.review .bar { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 22px 0 12px; position: relative; }
body.review .bar::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 8px; border-radius: 0 0 6px 6px;
  background: linear-gradient(to right, var(--tangerine) 0 33%, var(--lime) 33% 66%, var(--pink) 66%); }
body.review .wordmark { color: var(--ink); }
body.review .wordmark .sub { color: var(--muted); font: 600 .85rem var(--font-body); margin-left: 4px; }
body.review .pick { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font: 700 .88rem var(--font-body); min-height: 34px; }
body.review .btn { border-width: 1px; border-color: var(--line); color: var(--ink); background: var(--surface); }
body.review .btn.primary { background: var(--accent); border-color: var(--accent); color: #06121f; }
body.review .panel, body.review .read { border-width: 1px; }
body.review .grid input, body.review .grid select { background: #0b0f16; border-width: 1px; }
/* a select's list is drawn by the system, which keeps its own white unless told: the dark page's options say their colours outright */
body.review select { background-color: #0b0f16; color: var(--ink); }
body.review option, body.review optgroup { background-color: #161b22; color: #e8edf4; }
/* the cue said at the playhead, under the picture */
#stage-cue { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; min-height: 1.6em; padding: 4px 2px 0; font-size: .92rem; }
#stage-cue .said { font-weight: 800; color: var(--ink); }
#stage-cue .said.bad { color: var(--bad); }
#stage-cue .faults { font-size: .82rem; font-weight: 700; color: var(--bad); }
/* the graph's readout under the pointer */
.lanes-tip { position: fixed; z-index: 50; pointer-events: none; max-width: 300px; background: #0b0f16; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: 600 .78rem/1.35 var(--font-body); box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.lanes-tip b { color: var(--ink); } .lanes-tip .bad { color: var(--bad); } .lanes-tip .good { color: var(--good); } .lanes-tip .dim { color: var(--muted); }
.tabs { display: flex; gap: 6px; }
.tab { background: var(--surface); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font: 700 .85rem var(--font-body); cursor: pointer; }
.tab[aria-selected="true"] { color: var(--ink); border-color: var(--accent); }
a.chip { text-decoration: none; }
.review-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 900px) { .review-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } }
.side-col { display: grid; gap: 14px; min-width: 0; align-content: start; }
.stage.small { max-height: 48vh; }
.stage-col { display: grid; gap: 14px; min-width: 0; }
.lanes-panel .log { max-height: 160px; }
.stage.small video { opacity: 1; object-fit: contain; }
.stage.small canvas { pointer-events: none; }
.btn.file { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 6px 0 10px; }
.numbers label { display: grid; gap: 2px; font-size: .74rem; line-height: 1.2; color: var(--muted); }
.numbers input { width: 100%; box-sizing: border-box; font: 700 .92rem var(--font-body); padding: 5px 7px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.tracked { width: 100%; border-collapse: collapse; font-size: .84rem; margin: 4px 0 8px; }
.tracked th { text-align: left; font-weight: 800; padding: 4px 8px 4px 0; white-space: nowrap; color: var(--ink); vertical-align: top; }
.tracked td { padding: 4px 8px 4px 0; color: var(--muted); vertical-align: top; }
.tracked td.v { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.tracked tr.in td.v { color: var(--good); }
.tracked tr.out td.v, .tracked tr.out td b { color: var(--bad); }
.tracked tr + tr { border-top: 1px solid var(--line); }
.sliders label span { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .8rem; }
.sliders label span b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sliders input[type=range] { width: 100%; accent-color: var(--accent); }
#lanes { width: 100%; display: block; border-radius: 12px; background: #0b0f16; cursor: crosshair; }
.takes { margin: 10px 0; padding-left: 20px; color: var(--muted); font-size: .9rem; display: grid; gap: 4px; }
.takes b { color: var(--ink); }
.tiny-btn { min-height: 26px; padding: 0 10px; font-size: .75rem; flex: 0 0 auto; margin-left: 8px; }
.verdicts { width: 100%; border-collapse: collapse; font-size: .9rem; }
.verdicts th, .verdicts td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--line); }
.verdicts th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.verdicts .ok { color: var(--good); font-weight: 700; } .verdicts .no { color: var(--bad); font-weight: 700; }
.edit-fig { width: 100%; aspect-ratio: 4 / 3; background: #0b0f16; border-radius: 12px; touch-action: none; display: block; }
.demo-fig { width: 100%; max-width: 460px; aspect-ratio: 4 / 3; height: auto; display: block; margin: 0 auto; }
.demo-fig.muscle { aspect-ratio: 16 / 9; border-radius: 12px; }
body.review .demo-fig.muscle { background: #0b0f16; }
.seg .btn[aria-pressed="true"] { border-color: var(--accent); }
#anim-json { width: 100%; background: #0b0f16; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; margin-top: 8px; }
body.review .panel h2 .tiny { font-weight: 500; margin-left: 8px; }
.reps { margin: 10px 0 0; padding-left: 0; list-style: none; display: grid; gap: 8px; }
.reps .rep, .reps .miss, .reps .setup { background: #0b0f16; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; font-size: .9rem; }
.reps .rep.not { border-style: dashed; }
.reps .rep.focus { border-color: var(--accent); }
.reps .rep-head b { color: var(--ink); }
.reps .setup .rep-head b { color: var(--muted); }
.reps ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); display: grid; gap: 3px; }
.reps ul b { color: var(--bad); }
.reps .rep-before { color: var(--muted); margin-top: 4px; }
.reps .rep-before b { color: var(--warn); }
.reps .clean { color: var(--good); font-weight: 700; margin-top: 4px; }
.reps .said { color: var(--ink); }
.reps .rep-why { color: var(--muted); margin-top: 4px; font-size: .84rem; line-height: 1.4; }
.reps .miss { border-style: dotted; }
.reps .miss .rep-head b { color: var(--warn); }
.reps .setup { cursor: default; background: transparent; }

/* ---- the builder ---- */
.build-form { display: grid; gap: 14px; margin: 14px 0; }
.build-sec h2 { margin-bottom: 6px; }
.build-form .grid label.wide { grid-column: 1 / -1; }
.build-form .grid label, .build-form .grid label > span, .build-form .grid input, .build-form .grid select { min-width: 0; }
.build-form .grid label > span { overflow-wrap: anywhere; line-height: 1.25; }
.build-form .grid textarea { width: 100%; min-height: 60px; font: 700 .95rem var(--font-body); }
.build-form .grid.tight { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.build-form label.check { display: flex; align-items: center; gap: 8px; align-self: end; min-height: 40px; }
.build-form label.check input { width: 18px; height: 18px; }
.rowbox { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 8px 0; }
.rowhead { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .9rem; }
.rowhead .muted { flex: 1 1 auto; }
.rowtools { margin-left: auto; display: inline-flex; gap: 4px; }
.problems { margin: 0; padding-left: 20px; font-size: .88rem; display: grid; gap: 3px; }
.problems .error { color: var(--bad); }
.problems .warn { color: var(--warn); }
.problems .ok { color: var(--good); }
.problems b { font-weight: 700; margin-right: 4px; }
.problems li.goes { cursor: pointer; }
.problems li.goes:hover b, .problems li.goes:focus-visible b { text-decoration: underline; }
/* a problem, where it is on the form: an error outlined, a warning only worded; a closed section says what is inside */
.build-form .bad-at { outline: 2px solid var(--bad); outline-offset: 3px; border-radius: 8px; }
.build-form .at-msg { display: block; flex-basis: 100%; grid-column: 1 / -1; font-size: .78rem; font-weight: 700; font-style: normal; line-height: 1.3; }
.build-form .at-msg.bad { color: var(--bad); }
.build-form .at-msg.warn { color: var(--warn); }
.build-form details.has-bad > summary::after { content: ' · something to fix inside'; color: var(--bad); font-weight: 700; }
.build-form details.has-warn > summary::after { content: ' · something to look at inside'; color: var(--warn); font-weight: 700; }
.build-form .flash { animation: flash-at 1.6s ease-out; }
@keyframes flash-at { 0%, 35% { box-shadow: 0 0 0 6px rgba(224,36,94,.25); } 100% { box-shadow: 0 0 0 6px rgba(224,36,94,0); } }
body.review textarea { width: 100%; background: #0b0f16; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: 500 .85rem ui-monospace, SFMono-Regular, Menlo, monospace; }
body.review code { font: 500 .85em ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); }

/* ---- the builder in steps ---- */
.build-start { display: grid; gap: 10px; margin: 10px 0 14px; }
.pose-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.pose-pick button { display: grid; gap: 4px; justify-items: center; padding: 8px 6px 10px; border: 1px solid var(--line); border-radius: 12px; background: #0b0f16; color: var(--ink); cursor: pointer; font: 700 .8rem var(--font-body); }
.pose-pick button:hover, .pose-pick button:focus-visible { border-color: var(--accent); }
.pose-pick svg { width: 100%; height: 64px; }
.pose-pick svg .ink { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.pose-pick svg .floor { stroke: var(--line); stroke-width: 3; }
.step { counter-increment: step; }
.step h2::before { content: counter(step) " · "; color: var(--muted); }
.build-form { counter-reset: step; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chips .btn { min-height: 34px; font-size: .82rem; padding: 4px 10px; }
.chips .btn[aria-pressed="true"] { border-color: var(--accent); background: rgba(90,169,255,.12); }
.measure-fig { width: 100%; aspect-ratio: 16 / 7; background: #0b0f16; border-radius: 12px; touch-action: none; display: block; cursor: crosshair; }
.mcard { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 8px 0; display: grid; gap: 8px; }
.mcard .mhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.mcard .mhead b { font-size: 1rem; }
.mcard .mvals { color: var(--muted); font-size: .82rem; }
.mcard .mvals b { color: var(--ink); }
.fault-row { padding: 8px; border-radius: 8px; background: rgba(255,255,255,.03); }
.fault-row label.check { align-self: end; }
.build-form details { border: 1px dashed var(--line); border-radius: 10px; padding: 8px 10px; }
.build-form details summary { cursor: pointer; font-weight: 700; color: var(--muted); font-size: .85rem; }
.build-form details[open] summary { margin-bottom: 8px; }
.auto-note { font-size: .78rem; color: var(--muted); }
/* the builder's measurement cards: slots, and the landmark list a slot opens */
.mcard { position: relative; }
.mcard.editing { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(90,169,255,.25) inset; }
.chips.slots .btn { text-transform: none; }
/* a rule written as a sentence: words, selects and numbers in a row */
.sentence { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: .86rem; color: var(--muted); }
.sentence .w { white-space: nowrap; }
.sentence .inline, .chips.slots .inline { font: 700 .84rem var(--font-body); color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; min-height: 30px; max-width: 100%; }
.sentence .inline.num { width: 5.2em; font-variant-numeric: tabular-nums; }
.sentence .inline.wide { flex: 1 1 160px; min-width: 120px; }
.sentence .inline:not(.num):not(.wide) { max-width: 22em; }
.mhead .inline { font: 700 .8rem var(--font-body); color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; }
.mcard { gap: 6px; padding: 8px 10px; }
.mcard .fault-row { padding: 6px 8px; }
.mcard > .tiny-btn { justify-self: start; }
/* the lanes' legend */
.lane-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0 2px; font-size: .76rem; color: var(--muted); }
.lane-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.lane-legend i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.lane-legend i.line { height: 0; border-top: 2px dashed; }
.lane-legend i.mark { height: 4px; }
.lm-pop { position: absolute; z-index: 5; left: 8px; right: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.35); display: grid; gap: 6px; }
.lm-title { font-size: .78rem; color: var(--muted); }
.lm-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.lm-grid .btn { min-height: 30px; font-size: .8rem; padding: 3px 9px; }

/* ---- the review page: a rep classified, and the numbers recommended ---- */
.reps .rep-label { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.reps .rep-label .lbl { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-right: 2px; }
/* the verdict chips, in the list and under the video alike: the one chosen is filled and ticked */
.rep-label .btn { padding: 3px 10px; font-size: .8rem; min-height: 0; border-radius: 999px; }
.rep-label .btn[aria-pressed="true"] { border-color: var(--accent); background: rgba(90,169,255,.22); color: var(--ink); }
.rep-label .btn.fault[aria-pressed="true"] { border-color: var(--bad); background: rgba(255,92,108,.24); }
.rep-label .btn.clean[aria-pressed="true"] { border-color: var(--good); background: rgba(53,208,127,.24); }
.rep-label .btn[aria-pressed="true"]::after { content: ' ✓'; font-weight: 900; }
#stage-verdict .rep-label .btn { padding: 5px 12px; font-size: .86rem; border-width: 2px; }
.reps .rep.skipped { opacity: .55; }
.recommend td.move { color: var(--warn); font-weight: 700; } .recommend td.fine { color: var(--good); } .recommend td.overlap { color: var(--bad); font-weight: 700; }
.recommend .btn.tiny-btn { padding: 2px 8px; font-size: .78rem; min-height: 0; }
.recommend .range { color: var(--muted); font-size: .82rem; }
.scroll-x { overflow-x: auto; max-width: 100%; }
#lanes { max-width: 100%; }

/* ---- the studio: one page, the exercise on the left and the recordings on the right ---- */
body.studio main, body.studio .bar { max-width: 1400px; }
body.studio .bar .spacer { flex: 1 1 auto; }
body.studio .bar .note { font-size: .82rem; color: var(--muted); max-width: 32ch; line-height: 1.2; }
body.studio .bar .note.bad { color: var(--bad); }
.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.studio-grid .col { display: grid; gap: 14px; min-width: 0; align-content: start; }
.studio-grid .col > * { min-width: 0; }
@media (min-width: 900px) {
  .studio-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .stage.small { max-height: 34vh; }
}
@media (max-width: 899px) {
  /* the columns dissolve into one, in the owner's order: the drawing, the recordings and the stage, the reps, then the builder */
  .studio-grid .col { display: contents; }
  #fig-panel { order: 1; } #recordings-panel { order: 2; } #stage-wrap { order: 3; } #reps-panel { order: 4; }
  #measures-panel { order: 5; } #start-panel { order: 5; } #suggest-panel { order: 6; } #exercise-panel { order: 7; } #numbers-panel { order: 8; } #problems-panel { order: 9; } #file-panel { order: 10; }
  .stage.small { max-height: 40vh; }
}
#fig-demo { max-width: none; }
#fig-editor { display: grid; gap: 10px; margin-top: 8px; }
.build-form .build-sec { margin: 0; }
.tiny-h { font: 800 .8rem var(--font-body); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 4px; }
.strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .86rem; color: var(--muted); padding: 6px 0 10px; }
.strip:empty { display: none; }
/* a recommendation under the fault row it concerns */
.mcard .rec { font-size: .84rem; line-height: 1.4; padding: 4px 8px 4px 12px; border-left: 3px solid var(--line); color: var(--muted); margin: 2px 0 6px; }
.mcard .rec.fine { border-color: var(--good); } .mcard .rec.move { border-color: var(--warn); } .mcard .rec.overlap { border-color: var(--bad); }
.mcard .rec b { color: var(--ink); } .mcard .rec .btn { margin-left: 6px; }
.mcard .rec details { display: inline; } .mcard .rec summary { display: inline; cursor: pointer; color: var(--accent); }
.mcard .rec ul { margin: 4px 0 0; padding-left: 18px; }
.mcard .meaning { color: var(--muted); font-size: .82rem; line-height: 1.4; margin: 2px 0 6px; }
.mcard .mhead b.what { font-size: .98rem; }
/* a card closes to its head: what it is, its values, and a line of what it holds */
.mcard .fold { padding: 0 7px; min-height: 0; font-size: .8rem; }
.mcard .msum { flex-basis: 100%; color: var(--muted); font-size: .8rem; }
.mcard:not(.collapsed) .msum { display: none; }
.mcard.collapsed { gap: 0; }
.mcard.collapsed.has-bad .msum::after { content: ' · something to fix inside'; color: var(--bad); font-weight: 700; }
.mcard.collapsed.has-warn .msum::after { content: ' · something to look at inside'; color: var(--warn); font-weight: 700; }
/* a measure the studio found, not one the exercise has */
.sugg-tag { display: inline-block; font: 800 .68rem var(--font-body); text-transform: uppercase; letter-spacing: .06em; color: #06121f; background: var(--warn); border-radius: 999px; padding: 1px 7px; margin-right: 6px; vertical-align: 1px; }
/* one rep at a time */
.stage-bar .one-rep { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--muted); }
#rep-wait { font-size: .84rem; color: var(--warn); font-weight: 700; }
#rep-wait:empty { display: none; }
.mcard .fault-row .edge { color: var(--muted); font-size: .82rem; flex-basis: 100%; }
.mcard .fault-row .more-f { display: grid; gap: 6px; flex-basis: 100%; padding: 6px 0 2px 8px; border-left: 2px solid var(--line); }
.mcard .sentence .ghost { color: var(--muted); font-size: .82rem; }
/* the recordings list and the stage bar */
.rec-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.rec-list li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #0b0f16; font-size: .86rem; }
.rec-list li[aria-current="true"] { border-color: var(--accent); }
.rec-list li b { color: var(--ink); } .rec-list li .meta { color: var(--muted); flex: 1 1 auto; }
.rec-list li select { font-size: .8rem; }
.stage-bar { align-items: center; margin: 6px 0 0; }
.stage-bar .tiny { color: var(--muted); }
#stage-verdict:empty { display: none; }
#stage-verdict .rep-label { margin: 6px 0 0; padding: 0; border: 0; }
#lanes { margin-top: 6px; }
.reps .rec-group { list-style: none; }
.reps .rec-group > .group-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin: 10px 0 6px; color: var(--ink); font-weight: 700; }
.reps .rec-group > .group-head .meta { color: var(--muted); font-weight: 500; font-size: .84rem; }
.reps .rec-group > ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.rep-label .btn.provisional[aria-pressed="true"] { border-style: dashed; opacity: .8; }
/* a fault the coach found in the rep: a dot on its chip, amber when it was in the pause before */
.rep-label .btn.seen::before { content: '●'; color: var(--bad); font-size: .62em; margin-right: 5px; vertical-align: 1px; }
.rep-label .btn.seen.before::before { color: var(--warn); }
.rep-label .saw { flex-basis: 100%; font-size: .8rem; color: var(--muted); }
.rep-label .saw b { color: var(--bad); font-weight: 700; }
/* which side the measurements read, above the cards */
.side-pick { margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.side-pick .sentence { margin: 0; } .side-pick p { margin: 6px 0 0; }
.lm-sides .btn[aria-pressed="true"] { border-color: var(--accent); background: rgba(90,169,255,.14); }
.lm-help { font-size: .76rem; color: var(--muted); line-height: 1.35; }
.lm-body { display: grid; gap: 6px; }
/* the start position */
#start-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
#start-form .w, #start-form .check span { white-space: normal; min-width: 0; }
#start-form .check { display: flex; gap: 8px; align-items: center; font-weight: 700; }
#start-form .start-rules { display: grid; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
#start-form .start-rules .check { font-weight: 500; align-items: flex-start; flex: 1 1 280px; }
#start-form .check input { flex: none; margin-top: 3px; }
#start-form input.wide { flex: 1 1 260px; min-width: 200px; }
#start-seen { margin-top: 8px; display: grid; gap: 3px; }
#start-seen:empty { display: none; }
#start-seen .linkbtn { margin-left: 6px; }
.rep-label .btn.other[aria-pressed="true"] { border-color: var(--warn); background: rgba(255,181,69,.18); }
/* measures not yet built */
.suggest-group h3 { font: 800 .9rem var(--font-body); margin: 10px 0 4px; }
.suggest-group h3 .tiny { font-weight: 500; margin-left: 6px; }
.suggest-row { background: #0b0f16; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 6px 0; font-size: .9rem; display: grid; gap: 6px; }
.suggest-row .dots { width: 100%; max-width: 360px; height: 22px; display: block; }
.suggest-row .why { color: var(--muted); font-size: .82rem; }
.suggest-row.existing { border-style: dashed; }
/* the try sheet */
.sheet[hidden] { display: none; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; display: grid; place-items: center; padding: 16px; }
.sheet-box { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; display: grid; gap: 6px; }
.sheet-box h2 { margin: 0 0 4px; }
.sheet-box .spacer { flex: 1 1 auto; }
/* the studio's list of equipment and shapes in the drawing */
.prop-list { display: grid; gap: 6px; margin: 6px 0; }
.prop-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-end; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.prop-row.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.prop-row > b { flex-basis: 100%; font-size: .9rem; }
.prop-row label { display: flex; flex-direction: column; gap: 2px; font-size: .78rem; color: var(--muted); }
.prop-row label.check { flex-direction: row; align-items: center; gap: 6px; }
.prop-row input[type=number] { width: 5.5em; }
.prop-row input[type=text] { width: 8em; }
.prop-row .row-acts { margin-left: auto; display: flex; gap: 6px; }
