:root {
  color-scheme: dark light;
  --bg: #121a1a; --surface: #1d2928; --raised: #263635; --text: #f2f5ef; --muted: #b7c7c1;
  --line: #6c817a; --accent: #a7e5c2; --accent-ink: #122c20; --warn: #ffd38b; --danger: #ffb5ac; --danger-ink: #42140f;
  --focus: #ffe29d; --radius: 12px; --space: clamp(20px, 4vw, 40px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px; line-height: 1.55; font-synthesis: none;
  background: var(--bg); color: var(--text); accent-color: var(--accent);
}
* { box-sizing: border-box; }
body { margin: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(110px + env(safe-area-inset-bottom)) env(safe-area-inset-left); }
[hidden], .hidden { display: none !important; }
a { color: var(--accent); text-underline-offset: .22em; }
button, input, select, textarea { font: inherit; color: inherit; }
button, .button, select, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), summary { min-height: 56px; }
button, .button { display: inline-flex; align-items: center; justify-content: center; padding: 13px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); font-weight: 650; text-align: center; cursor: pointer; line-height: 1.35; overflow-wrap: anywhere; }
button:hover, .button:hover { background: var(--raised); }
button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: default; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover, .button.primary:hover { filter: brightness(1.05); }
button.quiet { background: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
h1:focus { outline: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
input, textarea { caret-color: var(--accent); }
* { scrollbar-color: var(--line) var(--bg); scrollbar-width: thin; }
.app-header { max-width: 1120px; margin: auto; padding: 22px var(--space); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.wordmark { color: var(--text); font-size: 24px; font-weight: 750; text-decoration: none; display: inline-flex; gap: 5px; align-items: center; }
.wordmark > span { font-weight: 400; }
.wordmark svg { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 2; margin-right: 8px; }
.privacy-label, .demo-label { font-size: 14px; color: var(--muted); }
.demo-label { color: var(--warn); }
main { max-width: 1000px; margin: auto; padding: 36px var(--space) 50px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(30px, 4.5vw, 44px); line-height: 1.15; letter-spacing: -.025em; font-weight: 700; margin-bottom: 16px; text-wrap: balance; }
h2 { font-size: 26px; line-height: 1.25; margin-bottom: 16px; }
h3 { font-size: 21px; margin-bottom: 12px; }
p { max-width: 70ch; margin-bottom: 20px; }
.view-heading { margin-bottom: 34px; }
.view-heading > p { color: var(--muted); font-size: 20px; }
section, aside { margin-top: 36px; }
.notice { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 24px 0; overflow-wrap: anywhere; }
.notice p:last-child, .notice h2:last-child { margin-bottom: 0; }
.warning { color: var(--warn); }
.danger { color: var(--danger); }
.success { color: var(--accent); }
.status { max-width: 1000px; margin: 18px auto 0; padding: 16px var(--space); border-bottom: 1px solid currentColor; overflow-wrap: anywhere; }
.today-intro { display: grid; grid-template-columns: 1fr auto; gap: 32px; padding-bottom: 32px; border-bottom: 1px solid var(--line); margin-top: 0; }
.today-intro h2 { font-size: clamp(28px, 3vw, 36px); }
.today-intro p { color: var(--muted); }
.plan-start { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; min-width: 220px; }
.plan-start .duration { color: var(--text); font-size: 34px; font-variant-numeric: tabular-nums; margin-bottom: 12px; }
.duration span { font-size: 18px; color: var(--muted); }
.exercise-list { list-style: none; margin: 0 0 24px; padding: 0; }
.exercise-list li { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 19px 0; border-bottom: 1px solid var(--line); }
.exercise-list strong, .exercise-list span { display: block; }
.exercise-list li > div > span { font-size: 16px; color: var(--muted); margin-top: 5px; }
.level-label { font-size: 15px; white-space: nowrap; color: var(--muted); }
.daily-tip { padding-top: 28px; border-top: 1px solid var(--line); }
.daily-tip p { font-size: 22px; }
.disclaimer, .help { color: var(--muted); font-size: 16px; }
.disclaimer { margin-top: 36px; }
.field { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; font-weight: 600; }
.field input, select, textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 12px 14px; font-weight: 400; }
textarea { resize: vertical; }
textarea::placeholder, input::placeholder { color: var(--muted); opacity: 1; }
fieldset { min-width: 0; padding: 0; margin: 0 0 32px; border: 0; }
legend { font-size: 23px; font-weight: 650; margin-bottom: 20px; }
.check { display: flex; align-items: flex-start; gap: 16px; min-height: 56px; padding: 14px 0; cursor: pointer; }
.check input { flex: 0 0 24px; width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--accent); }
.range-field { margin-bottom: 38px; }
.range-field label { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 23px; }
output { font-size: 30px; color: var(--accent); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; min-height: 56px; margin: 0; cursor: pointer; }
.range-ends { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 400; color: var(--muted); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0; }
.actions > * { flex: 1 1 180px; }
form > .primary { width: 100%; }
.text-link { display: inline-flex; align-items: center; min-height: 56px; }
.bottom-nav { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); background: var(--bg); border-top: 1px solid var(--line); }
.bottom-nav a { min-height: 64px; padding: 5px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px; text-decoration: none; color: var(--muted); font-size: 14px; border-radius: 8px; }
.bottom-nav a[aria-current] { color: var(--accent); background: var(--surface); }
.bottom-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav circle { fill: var(--bg); }
.message { padding: 22px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.message header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.message header strong { color: var(--accent); }
.message time, .message small { font-size: 14px; color: var(--muted); }
.message p { white-space: pre-wrap; margin-bottom: 8px; }
.from-user { padding-left: 22px; }
.messages { margin-bottom: 36px; }
.empty { padding: 28px 0; }
.stats { display: flex; gap: 48px; margin: 0 0 40px; flex-wrap: wrap; }
.stats dt { color: var(--muted); }
.stats dd { margin: 8px 0 0; font-size: 36px; font-variant-numeric: tabular-nums; }
.stats dd span { font-size: 18px; }
.chart { display: block; width: 100%; height: auto; max-height: 300px; margin: 12px 0 28px; overflow: visible; }
.chart text { fill: var(--muted); font-size: 14px; }
.chart-grid path { stroke: var(--line); stroke-width: 1; }
.chart-before, .chart-after { fill: none; stroke-width: 3; }
.chart-before { stroke: var(--muted); stroke-dasharray: 7 5; }
.chart-after { stroke: var(--accent); }
.chart-dot { fill: var(--accent); }
.chart-legend { font-size: 15px; display: flex; gap: 20px; flex-wrap: wrap; color: var(--muted); }
.session-dots { display: flex; gap: 12px; flex-wrap: wrap; list-style: none; padding: 0; }
.session-dots li { border: 1px solid currentColor; padding: 8px 12px; border-radius: 6px; font-size: 14px; }
.green { color: var(--accent); } .amber { color: var(--warn); } .red { color: var(--danger); }
.functional div { margin-bottom: 22px; }
.functional dd { margin: 8px 0 0; color: var(--muted); }
.level-list { list-style: none; padding: 0; }
.level-list li { padding: 16px 0; border-bottom: 1px solid var(--line); }
.level-list strong, .level-list span { display: block; }
.level-list span { color: var(--muted); font-size: 16px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
td, th { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); }
summary { padding: 16px 0; cursor: pointer; }
.figure { display: block; width: min(100%, 360px); height: 200px; margin: 20px auto; color: var(--accent); }
.figure-ground, .figure-support { opacity: .65; stroke-width: 2; }
.steps { padding-left: 26px; font-size: 22px; }
.steps li { padding: 8px 0 12px 6px; }
.dose { font-size: 23px; font-weight: 650; }
.self-check ul { padding-left: 24px; }
.self-check li { margin-bottom: 12px; }
.session-position { color: var(--muted); font-size: 16px; margin-bottom: 16px; }
.in-session { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
.in-session main { max-width: 1000px; }
.in-session .privacy-label { display: none; }
.pain-bar { position: fixed; z-index: 20; bottom: 0; left: 0; right: 0; display: flex; gap: 12px; justify-content: center; padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: var(--bg); }
.pain-bar button { min-width: 0; flex: 1; max-width: 320px; }
.danger-button { background: var(--danger); color: var(--danger-ink); border-color: var(--danger); }
.danger-button:hover { background: var(--danger); filter: brightness(1.05); }
.exercise-running h1 { font-size: clamp(26px, 4vw, 36px); }
.camera-stage { position: relative; width: 100%; aspect-ratio: 16 / 10; min-height: 300px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #121a1a; }
.camera-stage video, .camera-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.mirrored { transform: scaleX(-1); }
.guided-figure { display: none; position: absolute; inset: 110px 0 0; color: #a7e5c2; }
.guided-figure .figure { color: inherit; }
.guided video, .guided canvas { visibility: hidden; }
.guided .guided-figure { display: block; }
.counter-band { position: relative; z-index: 2; background: #121a1a; color: #f2f5ef; text-align: center; padding: 16px 8px; }
.counter-band p { margin: 0 auto 3px; }
.counter { font-size: clamp(48px, 10vw, 88px); line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 20px; }
.correction { padding: 20px; margin: 16px 0; background: var(--surface); color: var(--accent); font-size: clamp(23px, 3vw, 32px); line-height: 1.4; border-radius: var(--radius); }
.correction.warning { color: var(--warn); }
.result { padding: 28px 0; border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; margin-bottom: 32px; }
.result p { color: var(--text); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 100; padding: 16px; background: var(--accent); color: var(--accent-ink); }
.skip-link:focus { top: 16px; }
@media (max-width: 620px) {
  .today-intro { grid-template-columns: 1fr; gap: 12px; }
  .plan-start { width: 100%; }
  .plan-start .primary { width: 100%; }
  .app-header { padding-top: 16px; padding-bottom: 16px; gap: 8px; }
  .privacy-label { display: none; }
  .demo-label { width: 100%; font-size: 12px; }
  main { padding-top: 28px; }
  .exercise-list li { gap: 10px; }
  .level-label { font-size: 13px; }
  .actions { flex-direction: column; }
  .actions > * { flex-basis: auto; }
  .camera-stage { min-height: 340px; }
  .counter-band { padding: 12px 6px; }
  .counter-band p:not(.counter) { font-size: 15px; }
  .pain-bar { gap: 8px; }
  .pain-bar button { padding: 12px 8px; font-size: 16px; }
  .bottom-nav a { font-size: 12px; }
  .notice { padding: 18px; }
  .steps { font-size: 20px; }
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f6f8f3; --surface: #e8eee6; --raised: #dbe5da; --text: #1a2b24; --muted: #4b6055; --line: #758b7b; --accent: #195b3c; --accent-ink: #fff; --warn: #7a4a00; --danger: #9e2921; --danger-ink: #fff; --focus: #7a4a00; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
