:root {
  --bg: #FFF6F0;
  --surface: #FFFFFF;
  --surface-2: #FFF1E9;
  --line: #F3E2D8;
  --ink: #2E2430;
  --ink-2: #6F6170;
  --ink-3: #A3949F;

  --peach: #FF8F6B;
  --peach-strong: #F26B45;
  --peach-soft: #FFE3D6;
  --peach-tint: #FFF0E8;

  --strength: #F57A55;
  --strength-bg: #FFE6DB;
  --cardio: #C2850E;
  --cardio-bg: #FFF1C2;
  --done: #3E9C83;
  --done-bg: #DCF1EA;
  --rest: #9D8FA3;
  --rest-bg: #F1ECF2;

  --radius: 26px;
  --radius-sm: 16px;
  --shadow: 0 1px 2px rgba(98, 54, 40, .05), 0 8px 24px rgba(98, 54, 40, .06);
  --font: 'Plus Jakarta Sans', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.lock { overflow: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; text-align: inherit; }
svg { display: block; }
h1, h2, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 19px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--ink-3); letter-spacing: .01em; }
.muted { color: var(--ink-2); font-size: 14px; }
.label { font-size: 13px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; margin: 22px 4px 10px; display: flex; align-items: center; gap: 8px; }
.label .hint { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink-3); }
.tag { background: var(--peach-soft); color: var(--peach-strong); border-radius: 99px; padding: 2px 9px; font-size: 11px; letter-spacing: .03em; }

.wrap {
  max-width: 1080px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 110px) max(16px, env(safe-area-inset-left));
}

/* ---------- Type tints ---------- */
.t-strength { --c: var(--strength); --cb: var(--strength-bg); }
.t-cardio { --c: var(--cardio); --cb: var(--cardio-bg); }
.t-rest { --c: var(--rest); --cb: var(--rest-bg); }
.type-icon { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; background: var(--cb); color: var(--c); flex: none; }
.type-icon svg { width: 24px; height: 24px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 22px; border-radius: 99px; font-weight: 700; font-size: 15px; transition: transform .12s ease, background .2s; }
.btn:active { transform: scale(.97); }
.btn svg { width: 19px; height: 19px; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.soft { background: var(--peach-soft); color: var(--peach-strong); }
.btn.ghost { background: var(--surface); border: 1.5px solid var(--line); }
.btn.danger { background: var(--peach-strong); color: #fff; }
.btn.block { width: 100%; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1.5px solid var(--line); flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 99px; background: var(--surface); border: 1.5px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.chip svg { width: 17px; height: 17px; }
.sync-synced { color: var(--done); }
.sync-offline, .sync-locked { color: var(--peach-strong); }

/* ---------- Layout ---------- */
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.top h1 { margin-top: 2px; }
.home-grid { display: grid; gap: 16px; }
.col { display: grid; gap: 16px; align-content: start; }
@media (min-width: 900px) {
  .home-grid { grid-template-columns: 1.1fr 1fr; gap: 20px; }
  .col { gap: 20px; }
}
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.row-head { display: flex; align-items: center; gap: 10px; }
.row-head .center { flex: 1; text-align: center; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--peach)); transition: width .4s ease; }

/* ---------- Today ---------- */
.today { display: grid; gap: 14px; background: linear-gradient(160deg, var(--cb) 0%, var(--surface) 70%); }
.today-head { display: flex; align-items: center; gap: 14px; }
.today-head h2 { font-size: 22px; }
.today .btn { justify-self: start; }
.done-badge { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; background: var(--done); color: #fff; display: grid; place-items: center; }
.done-badge svg { width: 18px; height: 18px; }

/* ---------- Week ---------- */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 18px; }
.wday { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 2px 11px; border-radius: 18px; background: var(--cb); position: relative; transition: transform .12s; }
.wday:active { transform: scale(.95); }
.wday .wd { font-size: 11px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.wday .dn { font-size: 18px; font-weight: 800; }
.wday .wi { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--c); }
.wday .wi svg { width: 17px; height: 17px; }
.wday .wl { font-size: 10.5px; font-weight: 600; color: var(--c); }
.wday.t-rest { background: #F8F4F7; }
.wday.is-done { background: var(--done-bg); }
.wday.is-done .wi { background: var(--done); color: #fff; }
.wday.is-done .wl { color: var(--done); }
.wday.is-today { box-shadow: inset 0 0 0 2px var(--ink); }
.stats { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.stat { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink-2); background: var(--surface-2); padding: 7px 12px 7px 8px; border-radius: 99px; }
.stat span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--cb); color: var(--c); }
.stat span svg { width: 14px; height: 14px; }
.stat b { color: var(--ink); }
.actions { display: flex; gap: 10px; margin-top: 16px; }
.actions .btn { flex: 1; }

/* ---------- Month ---------- */
.mgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.mgrid.head { margin: 18px 0 8px; }
.mgrid.head span { text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-3); }
.mday { aspect-ratio: 1 / 1; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: var(--cb); position: relative; }
.mday .n { font-size: 14px; font-weight: 700; }
.mday .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.mday.t-rest { background: transparent; }
.mday.t-rest .dot { background: #E3DAE2; }
.mday.out { opacity: .35; }
.mday.is-today { box-shadow: inset 0 0 0 2px var(--ink); }
.mday.is-done { background: var(--done); color: #fff; }
.mday .ck svg { width: 13px; height: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 16px; font-size: 12.5px; color: var(--ink-2); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.lg.t-rest i { background: #E3DAE2; }
.lg.done i { width: 16px; height: 16px; background: var(--done); color: #fff; display: grid; place-items: center; }
.lg.done i svg { width: 10px; height: 10px; }

/* ---------- Sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.sheet.open { pointer-events: auto; }
.backdrop { position: absolute; inset: 0; background: rgba(46, 36, 48, .32); animation: fade .2s ease; }
.panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto;
  background: var(--bg); border-radius: 30px 30px 0 0; padding: 10px 18px calc(env(safe-area-inset-bottom) + 22px);
  animation: up .28s cubic-bezier(.2, .9, .3, 1); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start;
}
.panel h2 { font-size: 22px; }
.grab { width: 40px; height: 5px; border-radius: 99px; background: #E8D7CD; justify-self: center; margin-bottom: 8px; }
@media (min-width: 700px) {
  .panel { left: 50%; right: auto; bottom: auto; top: 50%; width: 520px; transform: translate(-50%, -50%); border-radius: 30px; padding: 26px; animation: pop .22s ease; }
  .grab { display: none; }
}
@keyframes up { from { transform: translateY(100%); } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%); } }
@keyframes fade { from { opacity: 0; } }

.picks { display: grid; gap: 10px; margin-top: 6px; }
.pick { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 22px; background: var(--surface); border: 2px solid transparent; box-shadow: var(--shadow); }
.pick .pt { display: grid; flex: 1; }
.pick b { font-size: 17px; }
.pick small { color: var(--ink-2); font-size: 13.5px; }
.pick.sel { border-color: var(--c); }
.tick { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; flex: none; }
.tick svg { width: 15px; height: 15px; }

.seg { display: flex; gap: 6px; background: var(--surface); padding: 5px; border-radius: 22px; box-shadow: var(--shadow); }
.seg button { flex: 1; padding: 11px 6px; border-radius: 17px; font-weight: 700; font-size: 14px; text-align: center; color: var(--ink-2); display: grid; gap: 1px; }
.seg button small { font-weight: 500; font-size: 11.5px; color: var(--ink-3); }
.seg button.on { background: var(--ink); color: #fff; }
.seg button.on small { color: rgba(255, 255, 255, .7); }
.preview { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 4px 0 6px; }
.pv { display: grid; justify-items: center; gap: 4px; padding: 9px 0; border-radius: 15px; background: var(--cb); color: var(--c); }
.pv small { font-size: 10.5px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; }
.pv svg { width: 18px; height: 18px; }
.pv.kept { background: var(--done); color: #fff; }
.pv.kept small { color: #fff; }

.options { display: grid; gap: 10px; }
.option { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 22px; background: var(--surface); border: 2px solid transparent; box-shadow: var(--shadow); }
.option.sel { border-color: var(--peach); }
.option .ot { flex: 1; display: grid; gap: 2px; }
.option .ot small { font-size: 11.5px; font-weight: 700; color: var(--peach-strong); text-transform: uppercase; letter-spacing: .05em; }
.option .ot .muted { font-size: 13px; line-height: 1.35; }
.keyform { display: flex; gap: 8px; }
.keyform input { flex: 1; min-width: 0; height: 50px; border-radius: 99px; border: 1.5px solid var(--line); padding: 0 18px; font: inherit; background: var(--surface); }
.keyform input:focus { outline: 2px solid var(--peach); border-color: transparent; }

/* ---------- Thumbs ---------- */
.thumb { width: 92px; flex: none; border-radius: 16px; background: var(--peach-tint); overflow: hidden; }
.thumb svg { width: 100%; height: auto; }
.thumb.sm { width: 76px; }

/* ---------- Builder ---------- */
.bar-top { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.bar-top h1 { font-size: 24px; }
.slots { display: grid; gap: 10px; }
@media (min-width: 900px) { .slots { grid-template-columns: 1fr 1fr; } }
.slot { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); transition: transform .12s; }
.slot:active { transform: scale(.98); }
.slot .num { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; flex: none; }
.slot .info, .ex-title .info { flex: 1; display: grid; gap: 1px; min-width: 0; }
.slot .info small, .ex-title .info small { font-size: 11.5px; font-weight: 700; color: var(--peach-strong); text-transform: uppercase; letter-spacing: .05em; }
.slot .info b { font-size: 15.5px; line-height: 1.25; }
.slot .info .muted { font-size: 12.5px; }
.slot .swap { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; flex: none; }
.slot .swap svg { width: 18px; height: 18px; }
.sticky { position: fixed; left: 0; right: 0; bottom: 0; padding: 14px max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 14px) max(16px, env(safe-area-inset-left)); background: linear-gradient(to top, var(--bg) 70%, rgba(255, 246, 240, 0)); z-index: 10; }
.sticky .btn { max-width: 520px; margin: 0 auto; display: flex; min-height: 56px; font-size: 16px; }

.cardio-opts { display: grid; gap: 12px; }
@media (min-width: 900px) { .cardio-opts { grid-template-columns: 1fr 1fr; } }
.copt { display: grid; gap: 12px; padding: 12px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); border: 2px solid transparent; position: relative; }
.copt .fig { border-radius: 18px; background: var(--peach-tint); overflow: hidden; }
.copt .fig svg { width: 100%; height: auto; }
.copt .ct { display: grid; gap: 6px; padding: 0 6px 6px; }
.copt .ct b { font-size: 18px; }
.copt .tick { position: absolute; top: 22px; right: 22px; opacity: 0; transform: scale(.6); transition: .2s; }
.copt.sel { border-color: var(--peach); }
.copt.sel .tick { opacity: 1; transform: none; }
.pill { justify-self: start; display: inline-block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); padding: 3px 10px; border-radius: 99px; margin-top: 3px; }

/* ---------- Detail ---------- */
.status { display: flex; align-items: center; gap: 14px; margin: 14px 0 16px; }
.status .grow { flex: 1; display: grid; gap: 8px; }
.prog { display: grid; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.status.is-done { background: var(--done-bg); }
.status.is-done .type-icon { background: var(--done); color: #fff; }
.exlist { display: grid; gap: 12px; }
.ex { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ex-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.ex-title { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.ex-title b { font-size: 16px; line-height: 1.25; }
.check { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #E8D7CD; display: grid; place-items: center; color: transparent; flex: none; transition: .2s; }
.check svg { width: 18px; height: 18px; }
.check.on { background: var(--done); border-color: var(--done); color: #fff; }
.ex.done .ex-title b { color: var(--ink-3); }
.chev { width: 32px; height: 32px; display: grid; place-items: center; color: var(--ink-3); transition: transform .25s; flex: none; }
.chev svg { width: 20px; height: 20px; }
.ex.open .chev { transform: rotate(180deg); }
.ex-body { display: none; padding: 2px 18px 20px; gap: 16px; }
.ex.open .ex-body { display: grid; }
.ex-body > p { color: var(--ink-2); font-size: 15px; }
.poses { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.poses figure { margin: 0; display: grid; gap: 8px; align-content: start; }
.poses .fig { position: relative; border-radius: 18px; background: var(--peach-tint); overflow: hidden; }
.poses .fig svg { width: 100%; height: auto; }
.step-n { position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.poses figcaption { font-size: 13px; line-height: 1.4; color: var(--ink); }
@media (max-width: 340px) { .poses { grid-template-columns: 1fr; } }
.extra { margin: 0; padding-left: 20px; font-size: 13.5px; color: var(--ink); display: grid; gap: 4px; }
.extra li::marker { color: var(--peach-strong); font-weight: 700; }
.ex-cols { display: grid; gap: 16px; }
@media (min-width: 640px) { .ex-cols { grid-template-columns: 1.2fr 1fr; } }
.ex-body .label { margin: 0 0 10px; }
.cues ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cues li { display: flex; gap: 10px; font-size: 14.5px; align-items: flex-start; }
.cues li span { width: 20px; height: 20px; border-radius: 50%; background: var(--done-bg); color: var(--done); display: grid; place-items: center; flex: none; margin-top: 1px; }
.cues li span svg { width: 12px; height: 12px; }
.mwrap { display: flex; align-items: center; gap: 14px; background: var(--surface-2); border-radius: 18px; padding: 12px; }
.bodymap { width: 120px; flex: none; }
.mlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 14px; }
.mlist li { display: flex; align-items: center; gap: 8px; }
.mlist i { width: 12px; height: 12px; border-radius: 4px; background: #FFBFA6; }
.mlist li.p i { background: #FF7A59; }
.mlist li.p { font-weight: 700; }
.detail-actions { display: flex; gap: 10px; margin-top: 16px; }
.detail-actions .btn { flex: 1; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 92px); transform: translate(-50%, 20px); background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; padding: 11px 18px; border-radius: 99px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 440px) { .wday .wl { display: none; } .wday { padding: 10px 0 12px; } }
