:root {
  --ink: #102a2f;
  --muted: #66777a;
  --paper: #f4f0e8;
  --surface: #fffdf8;
  --line: rgba(16, 42, 47, 0.13);
  --coral: #ef6a4b;
  --coral-dark: #c9442b;
  --mint: #b9ddcc;
  --mint-dark: #30705c;
  --yellow: #f4cd69;
  --danger: #a63b32;
  --shadow: 0 18px 50px rgba(16, 42, 47, 0.11);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-width: 320px; min-height: 100%; background: var(--paper); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(239, 106, 75, 0.38); outline-offset: 3px; }

.app-shell { min-height: 100svh; max-width: 760px; margin: 0 auto; position: relative; }
.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) 22px 0;
  position: relative;
  z-index: 20;
}
.brand { border: 0; background: transparent; display: inline-flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; letter-spacing: -0.04em; padding: 8px 0; }
.brand-mark { width: 26px; height: 25px; display: flex; align-items: flex-end; gap: 3px; transform: skew(-8deg); }
.brand-mark i { display: block; width: 6px; border-radius: 4px; background: var(--coral); }
.brand-mark i:nth-child(1) { height: 12px; }
.brand-mark i:nth-child(2) { height: 22px; }
.brand-mark i:nth-child(3) { height: 16px; }
.avatar-button { border: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: white; font-size: 12px; font-weight: 750; }
main { padding: 24px 22px 112px; min-height: calc(100svh - 74px); }

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(40px, 12vw, 66px); line-height: .96; letter-spacing: -0.065em; margin-bottom: 18px; max-width: 620px; }
h2 { font-size: 32px; line-height: 1.04; letter-spacing: -0.045em; margin-bottom: 10px; }
h3 { font-size: 18px; letter-spacing: -0.025em; margin-bottom: 6px; }
.eyebrow { color: var(--coral-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; margin-bottom: 12px; }
.lead { color: var(--muted); font-size: 17px; line-height: 1.55; max-width: 520px; }
.small { color: var(--muted); font-size: 13px; line-height: 1.5; }
.muted { color: var(--muted); }
.view { animation: view-in .42s cubic-bezier(.2,.8,.2,1) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(12px); } }

.onboarding { min-height: calc(100svh - 112px); display: flex; flex-direction: column; }
.progress-rail { height: 3px; background: rgba(16,42,47,.1); margin: 0 0 38px; border-radius: 4px; overflow: hidden; }
.progress-rail > span { display: block; height: 100%; background: var(--coral); transition: width .35s ease; }
.onboarding-copy { flex: 1; }
.onboarding-footer { margin-top: 30px; display: grid; gap: 12px; }
.button { min-height: 54px; border-radius: 17px; border: 1px solid var(--ink); padding: 0 21px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 750; background: transparent; cursor: pointer; transition: transform .16s ease, background .16s ease, color .16s ease; }
.button:active { transform: scale(.98); }
.button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.button.primary { background: var(--ink); color: white; }
.button.coral { background: var(--coral); border-color: var(--coral); color: #fff; }
.button.ghost { border-color: transparent; color: var(--muted); }
.button.small-button { min-height: 42px; border-radius: 14px; padding: 0 16px; font-size: 14px; }
.button[disabled] { opacity: .45; pointer-events: none; }

.welcome-visual {
  height: min(35svh, 300px);
  margin: 10px -22px 34px;
  position: relative;
  overflow: hidden;
  background: var(--mint);
  border-radius: 0 0 44px 44px;
}
.welcome-visual::before { content:""; width: 210px; height: 210px; border: 1px solid rgba(16,42,47,.22); border-radius: 50%; position: absolute; left: 50%; top: 30px; transform: translateX(-50%); }
.welcome-visual::after { content:""; width: 92px; height: 180px; background: var(--ink); border-radius: 55px 55px 20px 20px; position: absolute; left: 50%; bottom: -62px; transform: translateX(-50%) rotate(-12deg); box-shadow: 72px -34px 0 -28px var(--coral), -70px -14px 0 -31px var(--yellow); }
.privacy-line { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; margin-top: 18px; }
.privacy-line svg { width: 18px; height: 18px; fill: none; stroke: var(--mint-dark); stroke-width: 1.8; }

.choice-list { display: grid; gap: 12px; margin-top: 28px; }
.choice {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,253,248,.55);
  min-height: 88px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  text-align: left;
  padding: 15px;
  gap: 16px;
  cursor: pointer;
  transition: border .18s, background .18s, transform .18s;
}
.choice:hover { transform: translateY(-2px); border-color: rgba(16,42,47,.34); }
.choice.selected { border-color: var(--coral); background: var(--surface); box-shadow: 0 0 0 2px rgba(239,106,75,.12); }
.choice-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--mint); flex: none; }
.choice-icon.shoulder { background: var(--yellow); }
.choice-icon svg { width: 32px; height: 32px; stroke: var(--ink); fill: none; stroke-width: 1.7; }
.choice-copy { flex: 1; }
.choice-copy strong { display: block; font-size: 17px; margin-bottom: 4px; }
.choice-copy span { color: var(--muted); font-size: 13px; }
.choice-check { width: 24px; height: 24px; border: 1px solid rgba(16,42,47,.25); border-radius: 50%; position: relative; flex: none; }
.selected .choice-check { background: var(--coral); border-color: var(--coral); }
.selected .choice-check::after { content:""; position:absolute; width: 7px; height: 4px; border-left: 2px solid white; border-bottom: 2px solid white; transform: rotate(-45deg); left: 7px; top: 7px; }

.pain-scale { display: grid; grid-template-columns: repeat(6,1fr); gap: 7px; margin: 28px 0 10px; }
.pain-scale button { aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-weight: 750; min-width: 0; }
.pain-scale button.selected { background: var(--ink); color: white; border-color: var(--ink); }
.scale-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.field-label { display: block; font-weight: 750; margin: 30px 0 11px; }
.select-grid { display: flex; gap: 9px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 11px 15px; font-size: 14px; }
.chip.selected { background: var(--ink); border-color: var(--ink); color: white; }
.safety-box { background: #f0dfd6; border-radius: 24px; padding: 19px; display: flex; gap: 14px; margin-top: 24px; }
.safety-box svg { width: 23px; height: 23px; flex: none; stroke: var(--danger); fill: none; stroke-width: 2; }
.safety-box p { font-size: 13px; line-height: 1.5; margin: 0; color: #71332e; }
.check-list { display: grid; gap: 11px; margin-top: 22px; }
.check-row { display: flex; gap: 13px; align-items: flex-start; padding: 13px 0; border-bottom: 1px solid var(--line); }
.check-row input { width: 21px; height: 21px; margin: 1px 0 0; accent-color: var(--danger); flex: none; }
.check-row span { font-size: 14px; line-height: 1.4; }
.urgent { text-align: center; justify-content: center; }
.urgent .urgent-mark { width: 72px; height: 72px; margin: 24px auto; border-radius: 50%; display: grid; place-items: center; background: #f0dfd6; font-size: 32px; color: var(--danger); }

.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 760px);
  height: calc(72px + env(safe-area-inset-bottom));
  padding: 8px 36px env(safe-area-inset-bottom);
  background: rgba(255,253,248,.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.bottom-nav[hidden] { display: none; }
.bottom-nav button { border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 3px; font-size: 11px; }
.bottom-nav svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.bottom-nav button.active { color: var(--coral-dark); font-weight: 750; }

.hello { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.today-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 0 0 30px; }
.today-head h1 { font-size: clamp(40px,10vw,58px); margin: 0; }
.readiness { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.readiness strong { display: block; color: var(--mint-dark); font-size: 18px; }
.session-feature { background: var(--ink); color: white; border-radius: 32px; overflow: hidden; box-shadow: var(--shadow); }
.session-art { height: 230px; background: var(--mint); position: relative; overflow: hidden; }
.session-art::before { content:""; width: 185px; height: 185px; border: 1px solid rgba(16,42,47,.25); position: absolute; border-radius: 50%; left: 50%; top: 22px; transform: translateX(-50%); }
.figure { position: absolute; width: 116px; height: 176px; left: 50%; bottom: -6px; transform: translateX(-50%); }
.figure span { display: block; position: absolute; background: var(--ink); border-radius: 99px; transform-origin: 50% 0; }
.figure .head { width: 34px; height: 34px; left: 41px; top: 0; background: var(--coral); }
.figure .body { width: 39px; height: 82px; left: 38px; top: 38px; transform: rotate(-10deg); }
.figure .arm-a { width: 15px; height: 76px; left: 42px; top: 48px; transform: rotate(57deg); }
.figure .arm-b { width: 15px; height: 76px; right: 42px; top: 49px; transform: rotate(-50deg); }
.figure .leg-a { width: 18px; height: 82px; left: 43px; top: 104px; transform: rotate(28deg); }
.figure .leg-b { width: 18px; height: 82px; right: 42px; top: 104px; transform: rotate(-23deg); }
.dumbbell { position: absolute; width: 76px; height: 13px; background: var(--yellow); border-radius: 6px; left: 50%; top: 108px; transform: translateX(-50%); }
.dumbbell::before, .dumbbell::after { content:""; position:absolute; width: 12px; height: 30px; top: -9px; background: var(--coral); border-radius: 4px; }
.dumbbell::after { right:0; }
.session-copy { padding: 22px; }
.session-meta { display: flex; gap: 8px; color: rgba(255,255,255,.68); font-size: 12px; margin: 11px 0 22px; }
.session-meta span + span::before { content:"·"; margin-right: 8px; }
.session-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.session-actions .button { border-color: rgba(255,255,255,.35); color: white; }
.session-actions .primary { background: white; border-color: white; color: var(--ink); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; margin: 38px 0 10px; }
.section-heading h2 { font-size: 24px; margin: 0; }
.text-button { border:0; background:transparent; color: var(--coral-dark); font-size: 13px; font-weight: 750; }
.exercise-list { display: grid; }
.exercise-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; min-height: 92px; border-bottom: 1px solid var(--line); }
.exercise-row:first-child { border-top: 1px solid var(--line); }
.exercise-number { width: 38px; height: 38px; border-radius: 13px; background: var(--surface); display: grid; place-items: center; color: var(--muted); font-weight: 800; font-size: 13px; }
.exercise-row.done .exercise-number { background: var(--mint); color: var(--mint-dark); }
.exercise-row h3 { font-size: 15px; margin: 0 0 4px; }
.exercise-row p { color: var(--muted); font-size: 12px; margin: 0; }
.row-action { border: 0; background: transparent; font-size: 24px; padding: 10px; }

.plan-intro { padding: 26px 0 22px; border-bottom: 1px solid var(--line); }
.plan-intro h1 { font-size: 44px; }
.week-tabs { display:flex; gap: 22px; overflow:auto; margin: 24px 0 8px; scrollbar-width:none; }
.week-tabs button { border:0; background:transparent; padding: 8px 0; color: var(--muted); white-space:nowrap; }
.week-tabs .active { color:var(--ink); font-weight:750; border-bottom:2px solid var(--coral); }
.plan-day { margin-top: 32px; }
.plan-day > p { font-size: 12px; color: var(--muted); text-transform: uppercase; font-weight: 800; letter-spacing: .1em; }
.lock { color: var(--muted); font-size: 12px; display:inline-flex; gap:5px; align-items:center; }

.progress-hero { background: var(--mint); border-radius: 32px; padding: 26px; margin-top: 16px; }
.progress-hero h1 { font-size: 48px; margin-bottom: 8px; }
.progress-hero p { max-width: 360px; }
.chart { height: 170px; display:flex; align-items:flex-end; gap: 12px; margin-top: 24px; padding-top: 20px; border-bottom: 1px solid rgba(16,42,47,.28); }
.bar-wrap { flex:1; display:grid; gap:7px; text-align:center; color: var(--muted); font-size: 10px; }
.bar { border-radius: 10px 10px 0 0; background: var(--ink); min-height: 8px; animation: grow .6s .15s cubic-bezier(.2,.8,.2,1) both; transform-origin: bottom; }
.bar.current { background: var(--coral); }
@keyframes grow { from { transform: scaleY(0); } }
.stats { display:grid; grid-template-columns: 1fr 1fr; gap:1px; background:var(--line); margin-top:30px; }
.stat { background:var(--paper); padding:22px 0; }
.stat:nth-child(even) { padding-left:22px; }
.stat strong { display:block; font-size:32px; letter-spacing:-.04em; }
.stat span { color:var(--muted); font-size:12px; }

.exercise-view { padding-bottom: 30px; }
.exercise-topline { display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; }
.icon-button { border:0; background:var(--surface); border-radius:50%; width:42px; height:42px; font-size:22px; display:grid; place-items:center; }
.exercise-view h1 { font-size: clamp(38px,11vw,58px); }
.video-frame { aspect-ratio: 4/5; max-height: 550px; background: var(--mint); border-radius: 30px; overflow: hidden; position: relative; }
.video-frame video, .video-frame canvas { width:100%; height:100%; object-fit:cover; display:block; }
.video-frame canvas { position:absolute; inset:0; }
.demo-canvas { z-index: 0; }
.demo-video { position:absolute; inset:0; z-index:1; opacity:0; transition:opacity .25s ease; }
.demo-video.ready { opacity:1; }
.video-badge { position:absolute; left:16px; top:16px; z-index:3; background:rgba(16,42,47,.88); color:#fff; border-radius:999px; padding:9px 12px; font-size:11px; font-weight:750; }
.video-controls { position:absolute; bottom:18px; left:50%; transform:translateX(-50%); display:flex; gap:10px; z-index:3; }
.video-controls button { width:50px; height:50px; border-radius:50%; border:0; background:white; box-shadow:var(--shadow); font-size:18px; }
.cue-list { margin:24px 0; display:grid; gap:0; }
.cue { display:flex; align-items:flex-start; gap:13px; padding:14px 0; border-bottom:1px solid var(--line); font-size:14px; line-height:1.45; }
.cue span { width:23px; height:23px; border-radius:50%; background:var(--mint); display:grid; place-items:center; font-size:11px; font-weight:800; flex:none; }
.advanced-warning { background:#f0dfd6; color:#71332e; border-radius:20px; padding:16px; font-size:13px; line-height:1.45; margin-bottom:18px; }

.camera-page { position:fixed; inset:0; z-index:50; background:#071a1e; color:#fff; display:flex; flex-direction:column; }
.camera-stage { position:relative; flex:1; min-height:0; overflow:hidden; }
.camera-stage video, .camera-stage canvas { width:100%; height:100%; object-fit:cover; position:absolute; inset:0; transform:scaleX(-1); }
.camera-stage canvas { z-index:2; }
.camera-gradient { position:absolute; inset:0; z-index:3; background:linear-gradient(to bottom,rgba(7,26,30,.72),transparent 28%,transparent 60%,rgba(7,26,30,.86)); pointer-events:none; }
.camera-head { position:absolute; z-index:11; top:max(18px,env(safe-area-inset-top)); left:18px; right:18px; display:flex; justify-content:space-between; align-items:center; }
.camera-head .icon-button { background:rgba(255,255,255,.16); color:white; backdrop-filter:blur(10px); }
.live-pill { padding:8px 12px; border-radius:999px; background:rgba(255,255,255,.15); font-size:11px; font-weight:800; backdrop-filter:blur(10px); }
.live-pill::before { content:""; display:inline-block; width:7px; height:7px; border-radius:50%; background:#ff7a5d; margin-right:6px; box-shadow:0 0 0 5px rgba(255,122,93,.14); }
.setup-guide { position:absolute; z-index:4; inset:0; display:grid; place-items:center; pointer-events:none; }
.body-outline { width:34%; max-width:190px; height:65%; border:2px dashed rgba(255,255,255,.46); border-radius:48% 48% 28% 28%; }
.camera-feedback { position:absolute; z-index:5; left:18px; right:18px; bottom:calc(18px + env(safe-area-inset-bottom)); }
.metric-row { display:flex; justify-content:space-between; align-items:flex-end; margin-bottom:14px; }
.rep-count strong { font-size:52px; line-height:.8; display:block; letter-spacing:-.06em; }
.rep-count span, .angle-readout span { color:rgba(255,255,255,.62); font-size:11px; text-transform:uppercase; letter-spacing:.1em; }
.angle-readout { text-align:right; }
.angle-readout strong { font-size:24px; display:block; }
.coach-cue { background:rgba(255,255,255,.95); color:var(--ink); border-radius:22px; padding:17px 18px; display:flex; align-items:center; gap:13px; box-shadow:var(--shadow); }
.cue-dot { width:11px; height:11px; border-radius:50%; background:var(--coral); flex:none; box-shadow:0 0 0 6px rgba(239,106,75,.15); }
.coach-cue p { margin:0; font-size:14px; font-weight:750; }
.camera-permission { position:absolute; z-index:10; inset:0; display:grid; place-items:center; padding:28px; background:var(--ink); text-align:center; }
.camera-permission svg { width:60px; height:60px; stroke:var(--mint); fill:none; stroke-width:1.2; margin-bottom:20px; }
.camera-permission h2 { color:white; }
.camera-permission p { color:rgba(255,255,255,.65); max-width:340px; line-height:1.5; }
.camera-permission .button { margin-top:14px; background:white; border-color:white; color:var(--ink); }
.model-status { font-size:11px; color:rgba(255,255,255,.54); margin:10px 0 0; }

.profile-sheet { position:fixed; inset:0; background:rgba(16,42,47,.3); backdrop-filter:blur(6px); z-index:60; display:flex; align-items:flex-end; }
.profile-panel { width:100%; max-width:760px; margin:0 auto; background:var(--surface); border-radius:32px 32px 0 0; padding:24px 22px calc(28px + env(safe-area-inset-bottom)); animation:sheet-up .28s ease both; }
@keyframes sheet-up { from { transform:translateY(30%); opacity:0; } }
.sheet-handle { width:44px; height:4px; border-radius:4px; background:var(--line); margin:0 auto 24px; }
.profile-line { display:flex; align-items:center; gap:15px; margin:20px 0 28px; }
.profile-avatar { width:58px; height:58px; border-radius:50%; display:grid; place-items:center; background:var(--ink); color:white; font-weight:800; }
.profile-actions { display:grid; gap:10px; }
.profile-actions .button { width:100%; }

.toast { position:fixed; z-index:100; left:50%; bottom:96px; transform:translate(-50%,20px); background:var(--ink); color:white; border-radius:999px; padding:11px 16px; font-size:12px; opacity:0; pointer-events:none; transition:.25s ease; white-space:nowrap; }
.toast.show { opacity:1; transform:translate(-50%,0); }

@media (min-width: 760px) {
  body { padding: 22px 0; }
  .app-shell { min-height: calc(100svh - 44px); background:var(--paper); border-radius:38px; overflow:hidden; box-shadow:0 12px 70px rgba(16,42,47,.12); }
  .bottom-nav { bottom:22px; border-radius:0 0 38px 38px; }
  .camera-page { width:min(100%,760px); left:50%; transform:translateX(-50%); border-radius:38px; overflow:hidden; top:22px; bottom:22px; }
  .profile-sheet { justify-content:center; }
  .profile-panel { border-radius:32px; margin-bottom:24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.01ms !important; animation-iteration-count:1 !important; scroll-behavior:auto !important; transition-duration:.01ms !important; }
}
