:root {
  --bg: #f3f8f7; --panel: #fff; --ink: #17212f; --muted: #5d6b7e; --line: #dde3ea;
  --brand: #07807c; --brand-soft: #e0f4f2; --accent: #12a59f; --pink: #12a59f; --navy: #0b3b6f; --teal: #068789;
  --grad: linear-gradient(135deg, #067a7a 0%, #0f9a94 55%, #2bb5a4 100%);
  --ok: #1d7a46; --ok-soft: #e3f4ea; --warn: #9a5a00; --warn-soft: #fff4e5; --bad: #b3261e; --bad-soft: #fde7e7;
  --radius: 18px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b; --panel: #18202a; --ink: #e8edf3; --muted: #9aa8b8; --line: #2a3542;
    --brand: #5cc8c1; --brand-soft: #0f2f2e; --ok: #5bd08c; --ok-soft: #13301f;
    --warn: #ffd9a3; --warn-soft: #3a2a12; --bad: #ffb4ab; --bad-soft: #3d1717; color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; }
button { font: inherit; cursor: pointer; color: inherit; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
[hidden] { display: none !important; }

/* phone frame on desktop, full-bleed on mobile */
.device { position: relative; max-width: 430px; margin: 0 auto; min-height: 100vh; background: var(--bg); }
@media (min-width: 640px) {
  body { background: radial-gradient(circle at 30% 20%, #eef8f6, #d3ebe7); padding: 28px 0; }
  .device { height: 880px; min-height: 0; border-radius: 44px; overflow: hidden;
    box-shadow: 0 0 0 12px #111, 0 30px 80px rgba(4,70,68,.35); }
  .device .app { height: 100%; overflow-y: auto; }
  .tabs { position: absolute !important; }
}
@media (min-width: 640px) and (prefers-color-scheme: dark) { body { background: #05080c; } }
.app { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.app.no-tabs { padding-bottom: 0; }

/* bottom tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; max-width: 430px; margin: 0 auto; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--panel);
  border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px;
  color: var(--muted); padding: 4px 0; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--brand); font-weight: 600; }

/* headers */
.hero { background: var(--grad); color: #fff; padding: calc(22px + env(safe-area-inset-top)) 20px 64px;
  border-radius: 0 0 28px 28px; }
.hero .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero small { opacity: .85; }
.hero h1 { font-size: 1.5rem; margin-top: 4px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: grid; place-items: center; font-weight: 700; border: 2px solid rgba(255,255,255,.5); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 12px; background: var(--bg); }
.topbar h2 { font-size: 1.2rem; flex: 1; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); display: grid; place-items: center; font-size: 18px; }

.wrap { padding: 0 16px; }
.lift { margin-top: -44px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; }
.card.shadow { box-shadow: 0 8px 24px rgba(4,70,68,.08); border-color: transparent; }
.card h3 { font-size: 1.02rem; margin-bottom: 4px; }
.muted { color: var(--muted); }
.sm { font-size: .86rem; }
.xs { font-size: .76rem; }
.section-t { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 2px 10px; }
.section-t h3 { font-size: 1.05rem; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px;
  font-size: .76rem; font-weight: 600; background: var(--brand-soft); color: var(--brand); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0;
  border-radius: 14px; padding: 14px 18px; font-weight: 600; background: var(--grad); color: #fff;
  width: 100%; box-shadow: 0 6px 18px rgba(6,122,122,.28); }
.btn.ghost { background: var(--panel); color: var(--brand); border: 1.5px solid var(--line); box-shadow: none; }
.btn.small { width: auto; padding: 9px 14px; font-size: .9rem; border-radius: 12px; }
.btn:disabled { opacity: .45; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* login */
.login { min-height: 100vh; display: flex; flex-direction: column; background: var(--grad); color: #fff;
  padding: calc(40px + env(safe-area-inset-top)) 24px 32px; }
@media (min-width: 640px) { .login { min-height: 100%; height: 100%; } }
.login .logo { width: 72px; height: 72px; border-radius: 20px; background: #fff; padding: 8px; }
.login h1 { font-size: 2rem; margin: 22px 0 8px; }
.login p { opacity: .9; margin: 0 0 28px; }
.login .box { margin-top: auto; background: var(--panel); color: var(--ink); border-radius: 24px; padding: 20px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.field input { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit; }
.otp { display: flex; gap: 10px; }
.otp input { text-align: center; font-size: 1.3rem; letter-spacing: 2px; }

/* home */
.today { display: flex; gap: 14px; align-items: center; }
.ring { --p: 0; width: 76px; height: 76px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line) 0);
  display: grid; place-items: center; }
.ring > div { width: 60px; height: 60px; border-radius: 50%; background: var(--panel); display: grid;
  place-items: center; font-weight: 700; font-size: 1.05rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.stat b { display: block; font-size: 1.3rem; }
.stat span { font-size: .76rem; color: var(--muted); }
.banner { border-radius: 16px; padding: 14px; margin-bottom: 14px; display: flex; gap: 12px; align-items: flex-start; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner b { display: block; }

/* check-in */
.scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; margin: 8px 0 4px; }
.scale button { border: 1.5px solid var(--line); background: var(--bg); border-radius: 9px; padding: 8px 0;
  font-size: .82rem; font-weight: 600; }
.scale button.on { border-color: transparent; color: #fff; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.seg button { flex: 1; min-width: 80px; border: 1.5px solid var(--line); background: var(--bg);
  border-radius: 12px; padding: 10px 8px; font-size: .88rem; }
.seg button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.q { margin-bottom: 16px; }
.q label { font-weight: 600; font-size: .95rem; }

/* exercise list */
.ex { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; margin-bottom: 10px; color: var(--ink); width: 100%; text-align: left; }
.ex .thumb { width: 64px; height: 64px; flex: none; border-radius: 14px; background: var(--brand-soft); overflow: hidden; }
.ex .thumb svg { width: 100%; height: 100%; }
.ex .meta { flex: 1; min-width: 0; }
.ex .meta b { display: block; }
.ex .done { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); flex: none;
  display: grid; place-items: center; font-size: 14px; }
.ex .done.y { background: var(--ok); border-color: var(--ok); color: #fff; }
.ex.dim { opacity: .5; }

.phases { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.phase { flex: none; width: 150px; padding: 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.phase.on { background: var(--grad); color: #fff; border-color: transparent; }
.phase.on .muted { color: rgba(255,255,255,.85); }
.bar { height: 6px; border-radius: 9px; background: var(--line); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--grad); }
.phase.on .bar { background: rgba(255,255,255,.3); }
.phase.on .bar i { background: #fff; }

/* exercise detail */
.stage { background: var(--brand-soft); border-radius: 22px; aspect-ratio: 16/10; display: grid; place-items: center;
  position: relative; overflow: hidden; }
.stage svg { width: 92%; height: 92%; }
.stage .tag { position: absolute; left: 12px; top: 12px; }
.dose { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.dose div { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center; }
.dose b { display: block; font-size: 1.15rem; }
.dose span { font-size: .72rem; color: var(--muted); }
.cues li { margin-bottom: 6px; }
.cues { padding-left: 20px; margin: 8px 0 0; }
.note { border-left: 4px solid var(--accent); padding: 10px 12px; background: var(--panel); border-radius: 0 12px 12px 0; margin-bottom: 14px; }

/* player */
.player { min-height: 100vh; display: flex; flex-direction: column; padding: calc(14px + env(safe-area-inset-top)) 16px 24px; }
@media (min-width: 640px) { .player { min-height: 100%; } }
.player .prog { display: flex; gap: 4px; margin: 10px 0 16px; }
.player .prog i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.player .prog i.d { background: var(--brand); }
.big { font-size: 4rem; font-weight: 800; text-align: center; line-height: 1; font-variant-numeric: tabular-nums; }
.timer { position: relative; width: 180px; height: 180px; margin: 10px auto; }
.timer svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.timer .big { position: absolute; inset: 0; display: grid; place-items: center; font-size: 3rem; }
.modes { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.modes button { flex: 1; border: 0; background: none; padding: 7px; border-radius: 9px; font-size: .82rem; color: var(--muted); }
.modes button.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.audio-only { aspect-ratio: 16/10; border-radius: 22px; background: var(--grad); color: #fff; display: grid;
  place-items: center; text-align: center; padding: 20px; }
.audio-only .wave { display: flex; gap: 4px; justify-content: center; height: 40px; align-items: center; margin-bottom: 10px; }
.audio-only .wave i { width: 5px; border-radius: 4px; background: #fff; animation: wave 1s ease-in-out infinite; }
@keyframes wave { 0%,100% { height: 8px } 50% { height: 38px } }
.tapper { width: 100%; padding: 22px; border-radius: 22px; border: 0; background: var(--grad); color: #fff;
  font-size: 1.1rem; font-weight: 700; margin-top: 12px; }

/* progress */
.chart svg { width: 100%; height: auto; display: block; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.cal i { aspect-ratio: 1; border-radius: 8px; background: var(--line); display: grid; place-items: center;
  font-style: normal; font-size: .7rem; color: var(--muted); }
.cal i.full { background: var(--ok); color: #fff; }
.cal i.part { background: color-mix(in srgb, var(--ok) 40%, var(--line)); color: var(--ink); }
.cal i.today { outline: 2px solid var(--brand); outline-offset: 1px; }
.metric { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.metric:last-child { border-bottom: 0; }

/* coach chat */
.chat { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 140px; }
.msg { max-width: 84%; padding: 10px 14px; border-radius: 18px; font-size: .95rem; white-space: pre-line; }
.msg.bot { background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 6px; align-self: flex-start; }
.msg.me { background: var(--brand); color: #fff; border-bottom-right-radius: 6px; align-self: flex-end; }
@media (prefers-color-scheme: dark) { .msg.me { background: #0a8a85; } }
.msg.flag { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.composer { position: fixed; left: 0; right: 0; max-width: 430px; margin: 0 auto;
  bottom: calc(66px + env(safe-area-inset-bottom)); padding: 8px 12px; background: var(--bg); z-index: 15; }
@media (min-width: 640px) { .composer { position: absolute; } }
.composer .sugg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.composer .sugg button { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 99px;
  padding: 6px 12px; font-size: .8rem; }
.composer form { display: flex; gap: 8px; }
.composer input { flex: 1; padding: 12px 14px; border-radius: 99px; border: 1.5px solid var(--line);
  background: var(--panel); color: var(--ink); font: inherit; }
.composer form button { width: 46px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; font-size: 18px; }
.typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  margin: 0 2px; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s } .typing span:nth-child(3) { animation-delay: .4s }
@keyframes blink { 0%,80%,100% { opacity: .2 } 40% { opacity: 1 } }

/* profile */
.person { display: flex; gap: 12px; align-items: center; }
.person .avatar { background: var(--brand-soft); color: var(--brand); border: 0; }
.list a, .list div.li { display: flex; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.list > :last-child { border-bottom: 0; }

/* sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .sheet-bg { position: absolute; } }
.sheet { background: var(--panel); width: 100%; max-width: 430px; border-radius: 26px 26px 0 0;
  padding: 18px 18px calc(22px + env(safe-area-inset-bottom)); max-height: 92%; overflow-y: auto; animation: up .25s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 14px; }
@keyframes up { from { transform: translateY(40px); opacity: 0 } }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: #17212f; color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: .9rem; z-index: 60; animation: up .2s; }



/* login trainer photo */
.login p { margin-bottom: 18px; }
.login-hero { position: relative; flex: 1 1 0; min-height: 140px; margin: 0 -24px -40px; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.login-hero img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; display: block; }
.login-hero .chip { position: absolute; left: 24px; top: 14px; background: rgba(255,255,255,.92); color: #0b3b6f; }
.login .box { position: relative; z-index: 1; }
.login { height: 100vh; height: 100dvh; min-height: 620px; }

/* mode picker */
.mode-pick { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px;
  margin-bottom: 10px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); }
.mode-pick:hover { border-color: var(--brand); }
.mode-pick img, .mode-pick .avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--brand-soft); color: var(--brand); border: 0; }
.mode-pick div { flex: 1; } .mode-pick b { display: block; } .mode-pick span { font-size: .8rem; color: var(--muted); }
.mode-pick i { font-style: normal; font-size: 1.4rem; color: var(--brand); }

/* desktop presenter switch */
.demo-switch { display: none; }
@media (min-width: 900px) {
  .demo-switch { display: flex; position: fixed; top: 20px; left: 20px; z-index: 100; gap: 4px; align-items: center;
    background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 5px; box-shadow: 0 6px 20px rgba(4,70,68,.12); }
  .demo-switch span { font-size: .75rem; color: var(--muted); padding: 0 8px; }
  .demo-switch button { border: 0; background: none; padding: 7px 12px; border-radius: 10px; font-size: .85rem; color: var(--muted); }
  .demo-switch button.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
}

/* trainer */
.stat.shadowed { box-shadow: 0 8px 24px rgba(4,70,68,.08); border-color: transparent; }
.steppers { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; margin-top: 10px; }
.steppers > div { background: var(--bg); border-radius: 12px; padding: 6px 8px; text-align: center; }
.steppers span { font-size: .7rem; color: var(--muted); }
.steppers > div > div { display: flex; align-items: center; justify-content: space-between; }
.steppers button { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); font-weight: 700; }
.iconbtn:disabled { opacity: .3; }
.chip-btn { flex: none; border: 1.5px solid var(--line); background: var(--panel); border-radius: 99px; padding: 6px 14px; font-size: .85rem; }
.chip-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.msg.human { border: 1.5px solid var(--accent); }

/* brand */
.brandbar { background: #fff; border-radius: 18px; padding: 12px 16px; display: inline-flex; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.brandbar img { width: 230px; max-width: 100%; height: auto; display: block; }
.login h1 { margin-top: 20px; }

/* exercise thumbnails */
.art { width: 100%; height: 100%; display: grid; place-items: center; background: var(--grad); }
.art svg { width: 40%; height: 40%; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.art-mobility { background: linear-gradient(135deg, #0a8f8a, #4cc3b0); }
.art-isometric { background: linear-gradient(135deg, #1a6f86, #2aa3a8); }
.art-cardio { background: linear-gradient(135deg, #068789, #33c2a8); }
.art-balance { background: linear-gradient(135deg, #3d8f7a, #74c69d); }

/* exercise video / placeholder */
.vid { position: relative; aspect-ratio: 16/10; border-radius: 22px; overflow: hidden; background: #0a6f6c; }
.vid video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.vid.has-video video { opacity: 1; }
.vid.has-video .vp, .vid.has-video .vov { display: none; }
.vid .vp { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0%; transform: scale(1.0); }
.vid .vov { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 12px 14px;
  background: linear-gradient(180deg, rgba(4,70,68,.05) 0%, rgba(4,70,68,0) 45%, rgba(4,60,58,.82) 100%); color: #fff; }
.vid .vov .chip { align-self: flex-end; font-size: .7rem; background: rgba(255,255,255,.92); color: #0b3b6f; }
.vid .play { align-self: center; width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.25);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; border: 1.5px solid rgba(255,255,255,.6); }
.vid .play svg { width: 26px; height: 26px; fill: #fff; margin-left: 3px; }
.vid .vov b { display: block; font-size: 1.1rem; }
.vid .vov span { font-size: .8rem; opacity: .9; }
.vid .play { position: absolute; right: 14px; bottom: 14px; width: 48px; height: 48px; }
.vid .vov > div:last-child { padding-right: 60px; }

/* light landing — logo sits on white, teal accents */
.login { background: linear-gradient(180deg, #ffffff 0%, #eef8f6 55%, #d8efeb 100%); color: var(--navy); }
.login h1 { color: var(--navy); }
.login h1 em { font-style: normal; color: var(--teal); }
.login p { color: #4a6470; opacity: 1; }
.login .brandbar { box-shadow: none; padding: 0; background: none; }
.login .brandbar img { width: 260px; }
.login .box { box-shadow: 0 10px 30px rgba(4,70,68,.12); }
.login-hero { -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent); }
@media (prefers-color-scheme: dark) {
  .login { background: linear-gradient(180deg, #0f1a1a, #0d2422); color: var(--ink); }
  .login h1 { color: var(--ink); } .login p { color: var(--muted); }
  .login .brandbar { background: #fff; padding: 10px 14px; border-radius: 16px; }
}
.ex .thumb .art svg, .thumb .art svg { width: 42%; height: 42%; }
